xref: /aosp_15_r20/external/llvm/test/CodeGen/PowerPC/2007-01-31-InlineAsmAddrMode.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=ppc32
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=ppc64
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Test two things: 1) that a frameidx can be rewritten in an inline asm
5*9880d681SAndroid Build Coastguard Worker; 2) that inline asms can handle reg+imm addr modes.
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker	%struct.A = type { i32, i32 }
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workerdefine void @test1() {
11*9880d681SAndroid Build Coastguard Workerentry:
12*9880d681SAndroid Build Coastguard Worker	%Out = alloca %struct.A, align 4		; <%struct.A*> [#uses=1]
13*9880d681SAndroid Build Coastguard Worker	%tmp2 = getelementptr %struct.A, %struct.A* %Out, i32 0, i32 1
14*9880d681SAndroid Build Coastguard Worker	%tmp5 = call i32 asm "lwbrx $0, $1", "=r,m"(i32* %tmp2 )
15*9880d681SAndroid Build Coastguard Worker	ret void
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdefine void @test2() {
19*9880d681SAndroid Build Coastguard Workerentry:
20*9880d681SAndroid Build Coastguard Worker	%Out = alloca %struct.A, align 4		; <%struct.A*> [#uses=1]
21*9880d681SAndroid Build Coastguard Worker	%tmp2 = getelementptr %struct.A, %struct.A* %Out, i32 0, i32 0		; <i32*> [#uses=1]
22*9880d681SAndroid Build Coastguard Worker	%tmp5 = call i32 asm "lwbrx $0, $2, $1", "=r,r,bO,m"( i8* null, i32 0, i32* %tmp2 )		; <i32> [#uses=0]
23*9880d681SAndroid Build Coastguard Worker	ret void
24*9880d681SAndroid Build Coastguard Worker}
25