[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / PowerPC / ppc64-inline-asm.c
blobe3f2c2ff5507ce5d5a11b12894b420e967af1984
1 // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -O2 -emit-llvm -o - %s | FileCheck %s
3 _Bool test_wc_i1(_Bool b1, _Bool b2) {
4 _Bool o;
5 asm("crand %0, %1, %2" : "=wc"(o) : "wc"(b1), "wc"(b2) : );
6 return o;
7 // CHECK-LABEL: define{{.*}} zeroext i1 @test_wc_i1(i1 noundef zeroext %b1, i1 noundef zeroext %b2)
8 // CHECK: call i8 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i1 %b1, i1 %b2)
11 int test_wc_i32(int b1, int b2) {
12 int o;
13 asm("crand %0, %1, %2" : "=wc"(o) : "wc"(b1), "wc"(b2) : );
14 return o;
15 // CHECK-LABEL: signext i32 @test_wc_i32(i32 noundef signext %b1, i32 noundef signext %b2)
16 // CHECK: call i32 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i32 %b1, i32 %b2)
19 unsigned char test_wc_i8(unsigned char b1, unsigned char b2) {
20 unsigned char o;
21 asm("crand %0, %1, %2" : "=wc"(o) : "wc"(b1), "wc"(b2) : );
22 return o;
23 // CHECK-LABEL: zeroext i8 @test_wc_i8(i8 noundef zeroext %b1, i8 noundef zeroext %b2)
24 // CHECK: call i8 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i8 %b1, i8 %b2)
27 float test_fmaxf(float x, float y) {
28 asm("xsmaxdp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y));
29 return x;
30 // CHECK-LABEL: float @test_fmaxf(float noundef %x, float noundef %y)
31 // CHECK: call float asm "xsmaxdp ${0:x}, ${1:x}, ${2:x}", "=^ww,^ww,^ww"(float %x, float %y)
34 double test_fmax(double x, double y) {
35 asm("xsmaxdp %x0, %x1, %x2" : "=ws"(x) : "ws"(x), "ws"(y));
36 return x;
37 // CHECK-LABEL: double @test_fmax(double noundef %x, double noundef %y)
38 // CHECK: call double asm "xsmaxdp ${0:x}, ${1:x}, ${2:x}", "=^ws,^ws,^ws"(double %x, double %y)
41 void testZ(void *addr) {
42 asm volatile ("dcbz %y0\n" :: "Z"(*(unsigned char *)addr) : "memory");
43 // CHECK-LABEL: void @testZ(ptr noundef %addr)
44 // CHECK: call void asm sideeffect "dcbz ${0:y}\0A", "*Z,~{memory}"(ptr elementtype(i8) %addr)
47 void testZwOff(void *addr, long long off) {
48 asm volatile ("dcbz %y0\n" :: "Z"(*(unsigned char *)(addr + off)) : "memory");
49 // CHECK-LABEL: void @testZwOff(ptr noundef %addr, i64 noundef %off)
50 // CHECK: %[[VAL:[^ ]+]] = getelementptr i8, ptr %addr, i64 %off
51 // CHECK: call void asm sideeffect "dcbz ${0:y}\0A", "*Z,~{memory}"(ptr elementtype(i8) %[[VAL]])