Merging r259798, r259835:
[oota-llvm.git] / test / CodeGen / PowerPC / asm-constraints.ll
1 ; RUN: llc < %s -mcpu=pwr8 | FileCheck %s
2
3 ; Generated from following C code:
4 ;
5 ; void foo (int result, char *addr) {
6 ;   __asm__ __volatile__ (
7 ;     "ld%U1%X1 %0,%1\n"
8 ;     "cmpw %0,%0\n"
9 ;     "bne- 1f\n"
10 ;     "1: isync\n"
11 ;     : "=r" (result)
12 ;     : "m"(*addr) : "memory", "cr0");
13 ; }
14
15 target datalayout = "e-m:e-i64:64-n32:64"
16 target triple = "powerpc64le-unknown-linux-gnu"
17
18 ; Function Attrs: nounwind
19 ; Check that we accept 'U' and 'X' constraints.
20 define void @foo(i32 signext %result, i8* %addr) #0 {
21 entry:
22   %result.addr = alloca i32, align 4
23   %addr.addr = alloca i8*, align 8
24   store i32 %result, i32* %result.addr, align 4
25   store i8* %addr, i8** %addr.addr, align 8
26   %0 = load i8*, i8** %addr.addr, align 8
27   %1 = call i32 asm sideeffect "ld${1:U}${1:X} $0,$1\0Acmpw $0,$0\0Abne- 1f\0A1: isync\0A", "=r,*m,~{memory},~{cr0}"(i8* %0) #1, !srcloc !1
28   store i32 %1, i32* %result.addr, align 4
29   ret void
30 }
31
32 ; CHECK-LABEL: @foo
33 ; CHECK: ld [[REG:[0-9]+]], 0(4)
34 ; CHECK: cmpw [[REG]], [[REG]]
35 ; CHECK: bne- 0, .Ltmp[[TMP:[0-9]+]]
36 ; CHECK: .Ltmp[[TMP]]:
37 ; CHECK: isync
38
39 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
40 attributes #1 = { nounwind }
41
42 !llvm.ident = !{!0}
43
44 !0 = !{!"clang version 3.6.0 (trunk 217557)"}
45 !1 = !{i32 67, i32 91, i32 110, i32 126}