diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/CodeGen/asm-inout.c | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/CodeGen/asm-inout.c')
-rw-r--r-- | clang/test/CodeGen/asm-inout.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/clang/test/CodeGen/asm-inout.c b/clang/test/CodeGen/asm-inout.c new file mode 100644 index 0000000..c7d1aec --- /dev/null +++ b/clang/test/CodeGen/asm-inout.c @@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// PR3800 +int *foo(void); + +// CHECK: @test1 +void test1() { + // CHECK: [[REGCALLRESULT:%[a-zA-Z0-9\.]+]] = call i32* @foo() + // CHECK: call void asm "foobar", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i32* [[REGCALLRESULT]], i32* [[REGCALLRESULT]]) + asm ("foobar" : "+m"(*foo())); +} + +// CHECK: @test2 +void test2() { + // CHECK: [[REGCALLRESULT:%[a-zA-Z0-9\.]+]] = call i32* @foo() + // CHECK: load i32* [[REGCALLRESULT]] + // CHECK: call i32 asm + // CHECK: store i32 {{%[a-zA-Z0-9\.]+}}, i32* [[REGCALLRESULT]] + asm ("foobar" : "+r"(*foo())); +} + +// PR7338 +// CHECK: @test3 +void test3(int *vout, int vin) +{ + // CHECK: call void asm "opr $0,$1", "=*r|m|r,r|m|r,~{edi},~{dirflag},~{fpsr},~{flags}" + asm ("opr %[vout],%[vin]" + : [vout] "=r,=m,=r" (*vout) + : [vin] "r,m,r" (vin) + : "edi"); +} + +// PR8959 - This should implicitly truncate the immediate to a byte. +// CHECK: @test4 +int test4(volatile int *addr) { + unsigned char oldval; + // CHECK: call i8 asm "frob $0", "=r,0{{.*}}"(i8 -1) + __asm__ ("frob %0" : "=r"(oldval) : "0"(0xff)); + return (int)oldval; +} + +// <rdar://problem/10919182> - This should have both inputs be of type x86_mmx. +// CHECK: @test5 +typedef long long __m64 __attribute__((__vector_size__(8))); +__m64 test5(__m64 __A, __m64 __B) { + // CHECK: call x86_mmx asm "pmulhuw $1, $0\0A\09", "=y,y,0,~{dirflag},~{fpsr},~{flags}"(x86_mmx %{{.*}}, x86_mmx %{{.*}}) + asm ("pmulhuw %1, %0\n\t" : "+y" (__A) : "y" (__B)); + return __A; +} |