xref: /aosp_15_r20/external/llvm/test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 \
2*9880d681SAndroid Build Coastguard Worker; RUN:   -pre-RA-sched=source | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 \
4*9880d681SAndroid Build Coastguard Worker; RUN:   -pre-RA-sched=list-hybrid | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -regalloc=basic | FileCheck %s
6*9880d681SAndroid Build Coastguard Worker; Radar 7459078
7*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32"
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker%0 = type { i32, i32 }
10*9880d681SAndroid Build Coastguard Worker%s1 = type { %s3, i32, %s4, i8*, void (i8*, i8*)*, i8*, i32*, i32*, i32*, i32, i64, [1 x i32] }
11*9880d681SAndroid Build Coastguard Worker%s2 = type { i32 (...)**, %s4 }
12*9880d681SAndroid Build Coastguard Worker%s3 = type { %s2, i32, i32, i32*, [4 x i8], float, %s4, i8*, i8* }
13*9880d681SAndroid Build Coastguard Worker%s4 = type { %s5 }
14*9880d681SAndroid Build Coastguard Worker%s5 = type { i32 }
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; Make sure the cmp is not scheduled before the InlineAsm that clobbers cc.
17*9880d681SAndroid Build Coastguard Worker; CHECK: bl _f2
18*9880d681SAndroid Build Coastguard Worker; CHECK: cmp r0, #0
19*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: cmp
20*9880d681SAndroid Build Coastguard Worker; CHECK: InlineAsm Start
21*9880d681SAndroid Build Coastguard Workerdefine void @test(%s1* %this, i32 %format, i32 %w, i32 %h, i32 %levels, i32* %s, i8* %data, i32* nocapture %rowbytes, void (i8*, i8*)* %release, i8* %info) nounwind {
22*9880d681SAndroid Build Coastguard Workerentry:
23*9880d681SAndroid Build Coastguard Worker  %tmp1 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0
24*9880d681SAndroid Build Coastguard Worker  store volatile i32 1, i32* %tmp1, align 4
25*9880d681SAndroid Build Coastguard Worker  %tmp12 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 1
26*9880d681SAndroid Build Coastguard Worker  store i32 %levels, i32* %tmp12, align 4
27*9880d681SAndroid Build Coastguard Worker  %tmp13 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 3
28*9880d681SAndroid Build Coastguard Worker  store i8* %data, i8** %tmp13, align 4
29*9880d681SAndroid Build Coastguard Worker  %tmp14 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 4
30*9880d681SAndroid Build Coastguard Worker  store void (i8*, i8*)* %release, void (i8*, i8*)** %tmp14, align 4
31*9880d681SAndroid Build Coastguard Worker  %tmp15 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 5
32*9880d681SAndroid Build Coastguard Worker  store i8* %info, i8** %tmp15, align 4
33*9880d681SAndroid Build Coastguard Worker  %tmp16 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 6
34*9880d681SAndroid Build Coastguard Worker  store i32* null, i32** %tmp16, align 4
35*9880d681SAndroid Build Coastguard Worker  %tmp17 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 7
36*9880d681SAndroid Build Coastguard Worker  store i32* null, i32** %tmp17, align 4
37*9880d681SAndroid Build Coastguard Worker  %tmp19 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 10
38*9880d681SAndroid Build Coastguard Worker  store i64 0, i64* %tmp19, align 4
39*9880d681SAndroid Build Coastguard Worker  %tmp20 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 0
40*9880d681SAndroid Build Coastguard Worker  tail call  void @f1(%s3* %tmp20, i32* %s) nounwind
41*9880d681SAndroid Build Coastguard Worker  %tmp21 = shl i32 %format, 6
42*9880d681SAndroid Build Coastguard Worker  %tmp22 = tail call  zeroext i8 @f2(i32 %format) nounwind
43*9880d681SAndroid Build Coastguard Worker  %toBoolnot = icmp eq i8 %tmp22, 0
44*9880d681SAndroid Build Coastguard Worker  %tmp23 = zext i1 %toBoolnot to i32
45*9880d681SAndroid Build Coastguard Worker  %flags.0 = or i32 %tmp23, %tmp21
46*9880d681SAndroid Build Coastguard Worker  %tmp24 = shl i32 %flags.0, 16
47*9880d681SAndroid Build Coastguard Worker  %asmtmp.i.i.i = tail call %0 asm sideeffect "\0A0:\09ldrex $1, [$2]\0A\09orr $1, $1, $3\0A\09strex $0, $1, [$2]\0A\09cmp $0, #0\0A\09bne 0b", "=&r,=&r,r,r,~{memory},~{cc}"(i32* %tmp1, i32 %tmp24) nounwind
48*9880d681SAndroid Build Coastguard Worker  %tmp25 = getelementptr inbounds %s1, %s1* %this, i32 0, i32 2, i32 0, i32 0
49*9880d681SAndroid Build Coastguard Worker  store volatile i32 1, i32* %tmp25, align 4
50*9880d681SAndroid Build Coastguard Worker  %tmp26 = icmp eq i32 %levels, 0
51*9880d681SAndroid Build Coastguard Worker  br i1 %tmp26, label %return, label %bb4
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Workerbb4:
54*9880d681SAndroid Build Coastguard Worker  %l.09 = phi i32 [ %tmp28, %bb4 ], [ 0, %entry ]
55*9880d681SAndroid Build Coastguard Worker  %scevgep = getelementptr %s1, %s1* %this, i32 0, i32 11, i32 %l.09
56*9880d681SAndroid Build Coastguard Worker  %scevgep10 = getelementptr i32, i32* %rowbytes, i32 %l.09
57*9880d681SAndroid Build Coastguard Worker  %tmp27 = load i32, i32* %scevgep10, align 4
58*9880d681SAndroid Build Coastguard Worker  store i32 %tmp27, i32* %scevgep, align 4
59*9880d681SAndroid Build Coastguard Worker  %tmp28 = add i32 %l.09, 1
60*9880d681SAndroid Build Coastguard Worker  %exitcond = icmp eq i32 %tmp28, %levels
61*9880d681SAndroid Build Coastguard Worker  br i1 %exitcond, label %return, label %bb4
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Workerreturn:
64*9880d681SAndroid Build Coastguard Worker  ret void
65*9880d681SAndroid Build Coastguard Worker}
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Workerdeclare void @f1(%s3*, i32*)
68*9880d681SAndroid Build Coastguard Workerdeclare zeroext i8 @f2(i32)
69