forked from OSchip/llvm-project
parent
39a7aed050
commit
53cdf022b6
|
@ -142,7 +142,8 @@ def t2addrmode_imm8 : Operand<i32>,
|
||||||
let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm);
|
let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm);
|
||||||
}
|
}
|
||||||
|
|
||||||
def t2am_imm8_offset : Operand<i32> {
|
def t2am_imm8_offset : Operand<i32>,
|
||||||
|
ComplexPattern<i32, 1, "SelectT2AddrModeImm8Offset", []>{
|
||||||
let PrintMethod = "printT2AddrModeImm8OffsetOperand";
|
let PrintMethod = "printT2AddrModeImm8OffsetOperand";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,6 +612,49 @@ let mayLoad = 1 in
|
||||||
def t2STRDi8 : T2Ii8s4<(outs), (ins GPR:$src, t2addrmode_imm8s4:$addr),
|
def t2STRDi8 : T2Ii8s4<(outs), (ins GPR:$src, t2addrmode_imm8s4:$addr),
|
||||||
"strd", " $src, $addr", []>;
|
"strd", " $src, $addr", []>;
|
||||||
|
|
||||||
|
// Indexed stores
|
||||||
|
def t2STR_PRE : T2Iidxldst<(outs GPR:$base_wb),
|
||||||
|
(ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset),
|
||||||
|
AddrModeT2_i8, IndexModePre,
|
||||||
|
"str", " $src, [$base, $offset]!", "$base = $base_wb",
|
||||||
|
[(set GPR:$base_wb,
|
||||||
|
(pre_store GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>;
|
||||||
|
|
||||||
|
def t2STR_POST : T2Iidxldst<(outs GPR:$base_wb),
|
||||||
|
(ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset),
|
||||||
|
AddrModeT2_i8, IndexModePost,
|
||||||
|
"str", " $src, [$base], $offset", "$base = $base_wb",
|
||||||
|
[(set GPR:$base_wb,
|
||||||
|
(post_store GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>;
|
||||||
|
|
||||||
|
def t2STRH_PRE : T2Iidxldst<(outs GPR:$base_wb),
|
||||||
|
(ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset),
|
||||||
|
AddrModeT2_i8, IndexModePre,
|
||||||
|
"strh", " $src, [$base, $offset]!", "$base = $base_wb",
|
||||||
|
[(set GPR:$base_wb,
|
||||||
|
(pre_truncsti16 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>;
|
||||||
|
|
||||||
|
def t2STRH_POST : T2Iidxldst<(outs GPR:$base_wb),
|
||||||
|
(ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset),
|
||||||
|
AddrModeT2_i8, IndexModePost,
|
||||||
|
"strh", " $src, [$base], $offset", "$base = $base_wb",
|
||||||
|
[(set GPR:$base_wb,
|
||||||
|
(post_truncsti16 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>;
|
||||||
|
|
||||||
|
def t2STRB_PRE : T2Iidxldst<(outs GPR:$base_wb),
|
||||||
|
(ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset),
|
||||||
|
AddrModeT2_i8, IndexModePre,
|
||||||
|
"strb", " $src, [$base, $offset]!", "$base = $base_wb",
|
||||||
|
[(set GPR:$base_wb,
|
||||||
|
(pre_truncsti8 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>;
|
||||||
|
|
||||||
|
def t2STRB_POST : T2Iidxldst<(outs GPR:$base_wb),
|
||||||
|
(ins GPR:$src, GPR:$base, t2am_imm8_offset:$offset),
|
||||||
|
AddrModeT2_i8, IndexModePost,
|
||||||
|
"strb", " $src, [$base], $offset", "$base = $base_wb",
|
||||||
|
[(set GPR:$base_wb,
|
||||||
|
(post_truncsti8 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>;
|
||||||
|
|
||||||
|
|
||||||
// Address computation and loads and stores in PIC mode.
|
// Address computation and loads and stores in PIC mode.
|
||||||
let isNotDuplicable = 1, AddedComplexity = 10 in {
|
let isNotDuplicable = 1, AddedComplexity = 10 in {
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | \
|
||||||
|
; RUN: grep {strh .*\\\[.*\], #-4} | count 1
|
||||||
|
; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | \
|
||||||
|
; RUN: grep {str .*\\\[.*\],} | count 1
|
||||||
|
|
||||||
|
define i16 @test1(i32* %X, i16* %A) {
|
||||||
|
%Y = load i32* %X ; <i32> [#uses=1]
|
||||||
|
%tmp1 = trunc i32 %Y to i16 ; <i16> [#uses=1]
|
||||||
|
store i16 %tmp1, i16* %A
|
||||||
|
%tmp2 = ptrtoint i16* %A to i16 ; <i16> [#uses=1]
|
||||||
|
%tmp3 = sub i16 %tmp2, 4 ; <i16> [#uses=1]
|
||||||
|
ret i16 %tmp3
|
||||||
|
}
|
||||||
|
|
||||||
|
define i32 @test2(i32* %X, i32* %A) {
|
||||||
|
%Y = load i32* %X ; <i32> [#uses=1]
|
||||||
|
store i32 %Y, i32* %A
|
||||||
|
%tmp1 = ptrtoint i32* %A to i32 ; <i32> [#uses=1]
|
||||||
|
%tmp2 = sub i32 %tmp1, 4 ; <i32> [#uses=1]
|
||||||
|
ret i32 %tmp2
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | \
|
||||||
|
; RUN: grep {str.*\\!} | count 2
|
||||||
|
|
||||||
|
define void @test1(i32* %X, i32* %A, i32** %dest) {
|
||||||
|
%B = load i32* %A ; <i32> [#uses=1]
|
||||||
|
%Y = getelementptr i32* %X, i32 4 ; <i32*> [#uses=2]
|
||||||
|
store i32 %B, i32* %Y
|
||||||
|
store i32* %Y, i32** %dest
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
|
define i16* @test2(i16* %X, i32* %A) {
|
||||||
|
%B = load i32* %A ; <i32> [#uses=1]
|
||||||
|
%Y = getelementptr i16* %X, i32 4 ; <i16*> [#uses=2]
|
||||||
|
%tmp = trunc i32 %B to i16 ; <i16> [#uses=1]
|
||||||
|
store i16 %tmp, i16* %Y
|
||||||
|
ret i16* %Y
|
||||||
|
}
|
Loading…
Reference in New Issue