1 // RUN: %clang_cc1 -O2 -emit-llvm %s -o - -triple x86_64-unknown-linux-gnu | FileCheck %s
3 int test_cca(long nr
, volatile long *addr
) {
4 //CHECK-LABEL: @test_cca
5 //CHECK: = tail call i32 asm "cmp $2,$1", "={@cca},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
8 : "=@cca"(x
), "=m"(*(volatile long *)(addr
))
16 int test_ccae(long nr
, volatile long *addr
) {
17 //CHECK-LABEL: @test_ccae
18 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccae},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
21 : "=@ccae"(x
), "=m"(*(volatile long *)(addr
))
29 int test_ccb(long nr
, volatile long *addr
) {
30 //CHECK-LABEL: @test_ccb
31 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccb},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
34 : "=@ccb"(x
), "=m"(*(volatile long *)(addr
))
42 int test_ccbe(long nr
, volatile long *addr
) {
43 //CHECK-LABEL: @test_ccbe
44 //CHECK: tail call i32 asm "cmp $2,$1", "={@ccbe},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
47 : "=@ccbe"(x
), "=m"(*(volatile long *)(addr
))
55 int test_ccc(long nr
, volatile long *addr
) {
56 //CHECK-LABEL: @test_ccc
57 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccc},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
60 : "=@ccc"(x
), "=m"(*(volatile long *)(addr
))
68 int test_cce(long nr
, volatile long *addr
) {
69 //CHECK-LABEL: @test_cce
70 //CHECK: = tail call i32 asm "cmp $2,$1", "={@cce},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
73 : "=@cce"(x
), "=m"(*(volatile long *)(addr
))
81 int test_ccz(long nr
, volatile long *addr
) {
82 //CHECK-LABEL: @test_ccz
83 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccz},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
86 : "=@ccz"(x
), "=m"(*(volatile long *)(addr
))
94 int test_ccg(long nr
, volatile long *addr
) {
95 //CHECK-LABEL: @test_ccg
96 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccg},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
99 : "=@ccg"(x
), "=m"(*(volatile long *)(addr
))
107 int test_ccge(long nr
, volatile long *addr
) {
108 //CHECK-LABEL: @test_ccge
109 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccge},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
112 : "=@ccge"(x
), "=m"(*(volatile long *)(addr
))
120 int test_ccl(long nr
, volatile long *addr
) {
121 //CHECK-LABEL: @test_ccl
122 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccl},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
125 : "=@ccl"(x
), "=m"(*(volatile long *)(addr
))
133 int test_ccle(long nr
, volatile long *addr
) {
134 //CHECK-LABEL: @test_ccle
135 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccle},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
138 : "=@ccle"(x
), "=m"(*(volatile long *)(addr
))
146 int test_ccna(long nr
, volatile long *addr
) {
147 //CHECK-LABEL: @test_ccna
148 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccna},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
151 : "=@ccna"(x
), "=m"(*(volatile long *)(addr
))
159 int test_ccnae(long nr
, volatile long *addr
) {
160 //CHECK-LABEL: @test_ccnae
161 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnae},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
164 : "=@ccnae"(x
), "=m"(*(volatile long *)(addr
))
172 int test_ccnb(long nr
, volatile long *addr
) {
173 //CHECK-LABEL: @test_ccnb
174 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnb},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
177 : "=@ccnb"(x
), "=m"(*(volatile long *)(addr
))
185 int test_ccnbe(long nr
, volatile long *addr
) {
186 //CHECK-LABEL: @test_ccnbe
187 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnbe},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
190 : "=@ccnbe"(x
), "=m"(*(volatile long *)(addr
))
198 int test_ccnc(long nr
, volatile long *addr
) {
199 //CHECK-LABEL: @test_ccnc
200 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnc},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
203 : "=@ccnc"(x
), "=m"(*(volatile long *)(addr
))
211 int test_ccne(long nr
, volatile long *addr
) {
212 //CHECK-LABEL: @test_ccne
213 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccne},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
216 : "=@ccne"(x
), "=m"(*(volatile long *)(addr
))
224 int test_ccnz(long nr
, volatile long *addr
) {
225 //CHECK-LABEL: @test_ccnz
226 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnz},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
229 : "=@ccnz"(x
), "=m"(*(volatile long *)(addr
))
237 int test_ccng(long nr
, volatile long *addr
) {
238 //CHECK-LABEL: @test_ccng
239 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccng},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
242 : "=@ccng"(x
), "=m"(*(volatile long *)(addr
))
250 int test_ccnge(long nr
, volatile long *addr
) {
251 //CHECK-LABEL: @test_ccnge
252 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnge},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
255 : "=@ccnge"(x
), "=m"(*(volatile long *)(addr
))
263 int test_ccnl(long nr
, volatile long *addr
) {
264 //CHECK-LABEL: @test_ccnl
265 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnl},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
268 : "=@ccnl"(x
), "=m"(*(volatile long *)(addr
))
276 int test_ccnle(long nr
, volatile long *addr
) {
277 //CHECK-LABEL: @test_ccnle
278 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnle},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
281 : "=@ccnle"(x
), "=m"(*(volatile long *)(addr
))
289 int test_ccno(long nr
, volatile long *addr
) {
290 //CHECK-LABEL: @test_ccno
291 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccno},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
294 : "=@ccno"(x
), "=m"(*(volatile long *)(addr
))
302 int test_ccnp(long nr
, volatile long *addr
) {
303 //CHECK-LABEL: @test_ccnp
304 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccnp},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
307 : "=@ccnp"(x
), "=m"(*(volatile long *)(addr
))
315 int test_ccns(long nr
, volatile long *addr
) {
316 //CHECK-LABEL: @test_ccns
317 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccns},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
320 : "=@ccns"(x
), "=m"(*(volatile long *)(addr
))
328 int test_cco(long nr
, volatile long *addr
) {
329 //CHECK-LABEL: @test_cco
330 //CHECK: = tail call i32 asm "cmp $2,$1", "={@cco},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
333 : "=@cco"(x
), "=m"(*(volatile long *)(addr
))
341 int test_ccp(long nr
, volatile long *addr
) {
342 //CHECK-LABEL: @test_ccp
343 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccp},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
346 : "=@ccp"(x
), "=m"(*(volatile long *)(addr
))
354 int test_ccs(long nr
, volatile long *addr
) {
355 //CHECK-LABEL: @test_ccs
356 //CHECK: = tail call i32 asm "cmp $2,$1", "={@ccs},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
359 : "=@ccs"(x
), "=m"(*(volatile long *)(addr
))
367 _Bool
check_no_clobber_conflicts(void) {
368 //CHECK-LABEL: @check_no_clobber_conflicts
369 //CHECK: = tail call i8 asm "", "={@cce},~{cx},~{dirflag},~{fpsr},~{flags}"()
378 int test_assume_boolean_flag(long nr
, volatile long *addr
) {
379 //CHECK-LABEL: @test_assume_boolean_flag
380 //CHECK: %0 = tail call { i32, i32 } asm "cmp $2,$1", "={@cca},={@ccae},=*m,r,~{cc},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i64) %addr, i64 %nr)
381 //CHECK: [[RES1:%.*]] = extractvalue { i32, i32 } %0, 0
382 //CHECK: [[RES2:%.*]] = extractvalue { i32, i32 } %0, 1
383 //CHECK: %1 = icmp ult i32 [[RES1]], 2
384 //CHECK: tail call void @llvm.assume(i1 %1)
385 //CHECK: %2 = icmp ult i32 [[RES2]], 2
386 //CHECK: tail call void @llvm.assume(i1 %2)
389 : "=@cca"(x
), "=@ccae"(y
), "=m"(*(volatile long *)(addr
))