1// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s 2// PR3800 3int *foo(void); 4 5// CHECK: @test1 6void test1() { 7 // CHECK: [[REGCALLRESULT:%[a-zA-Z0-9\.]+]] = call i32* @foo() 8 // CHECK: call void asm "foobar", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i32* [[REGCALLRESULT]], i32* [[REGCALLRESULT]]) 9 asm ("foobar" : "+m"(*foo())); 10} 11 12// CHECK: @test2 13void test2() { 14 // CHECK: [[REGCALLRESULT:%[a-zA-Z0-9\.]+]] = call i32* @foo() 15 // CHECK: load i32* [[REGCALLRESULT]] 16 // CHECK: call i32 asm 17 // CHECK: store i32 {{%[a-zA-Z0-9\.]+}}, i32* [[REGCALLRESULT]] 18 asm ("foobar" : "+r"(*foo())); 19} 20 21// PR7338 22// CHECK: @test3 23void test3(int *vout, int vin) 24{ 25 // CHECK: call void asm "opr $0,$1", "=*r|m|r,r|m|r,~{edi},~{dirflag},~{fpsr},~{flags}" 26 asm ("opr %[vout],%[vin]" 27 : [vout] "=r,=m,=r" (*vout) 28 : [vin] "r,m,r" (vin) 29 : "edi"); 30} 31 32// PR8959 - This should implicitly truncate the immediate to a byte. 33// CHECK: @test4 34int test4(volatile int *addr) { 35 unsigned char oldval; 36 // CHECK: call i8 asm "frob $0", "=r,0{{.*}}"(i8 -1) 37 __asm__ ("frob %0" : "=r"(oldval) : "0"(0xff)); 38 return (int)oldval; 39} 40 41// <rdar://problem/10919182> - This should have both inputs be of type x86_mmx. 42// CHECK: @test5 43typedef long long __m64 __attribute__((__vector_size__(8))); 44__m64 test5(__m64 __A, __m64 __B) { 45 // CHECK: call x86_mmx asm "pmulhuw $1, $0\0A\09", "=y,y,0,~{dirflag},~{fpsr},~{flags}"(x86_mmx %{{.*}}, x86_mmx %{{.*}}) 46 asm ("pmulhuw %1, %0\n\t" : "+y" (__A) : "y" (__B)); 47 return __A; 48} 49