58 lines · c
1// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s2// PR38003int *foo(void);4 5// CHECK: @test16void test1(void) {7 // CHECK: [[REGCALLRESULT:%[a-zA-Z0-9\.]+]] = call ptr @foo()8 // CHECK: call void asm "foobar", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) [[REGCALLRESULT]], ptr elementtype(i32) [[REGCALLRESULT]])9 asm ("foobar" : "+m"(*foo()));10}11 12// CHECK: @test213void test2(void) {14 // CHECK: [[REGCALLRESULT:%[a-zA-Z0-9\.]+]] = call ptr @foo()15 // CHECK: load i32, ptr [[REGCALLRESULT]]16 // CHECK: call i32 asm17 // CHECK: store i32 {{%[a-zA-Z0-9\.]+}}, ptr [[REGCALLRESULT]]18 asm ("foobar" : "+r"(*foo()));19}20 21// PR733822// CHECK: @test323void 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: @test434int 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// This should have both inputs be of type <1 x i64>.42// CHECK: @test543typedef long long __m64 __attribute__((__vector_size__(8)));44__m64 test5(__m64 __A, __m64 __B) {45 // CHECK: call <1 x i64> asm "pmulhuw $1, $0\0A\09", "=y,y,0,~{dirflag},~{fpsr},~{flags}"(<1 x i64> %{{.*}}, <1 x i64> %{{.*}})46 asm ("pmulhuw %1, %0\n\t" : "+y" (__A) : "y" (__B));47 return __A;48}49 50// CHECK: @test651int test6(void) {52 typedef unsigned char __attribute__((vector_size(8))) _m64u8;53 _m64u8 __attribute__((aligned(16))) Mu8_0, __attribute__((aligned(16))) Mu8_1;54 // CHECK: call <8 x i8> asm "nop", "=y,0,~{dirflag},~{fpsr},~{flags}"(<8 x i8> %0)55 asm ("nop" : "=y"(Mu8_1 ) : "0"(Mu8_0 ));56 return 0;57}58