1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 %s -triple i686-pc-windows-msvc -emit-llvm -o - -fasm-blocks | FileCheck %s
4 // Check that we take EAX or EAX:EDX and return it from these functions for MSVC
15 // CHECK-LABEL: define dso_local i64 @f_i64()
16 // CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov eax, $$1\0A\09mov edx, $$1", "=&A,{{.*}}"
17 // CHECK: ret i64 %[[r]]
19 long long f_i64_reverse() {
25 // CHECK-LABEL: define dso_local i64 @f_i64_reverse()
26 // CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov edx, $$1\0A\09mov eax, $$1", "=&A,{{.*}}"
27 // CHECK: ret i64 %[[r]]
35 // CHECK-LABEL: define dso_local i32 @f_i32()
36 // CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov eax, $$1\0A\09mov edx, $$1", "=&{eax},~{edx},{{.*}}"
37 // CHECK: ret i32 %[[r]]
45 // CHECK-LABEL: define dso_local i32 @f_i32_reverse()
46 // CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov edx, $$1\0A\09mov eax, $$1", "=&{eax},~{edx},{{.*}}"
47 // CHECK: ret i32 %[[r]]
54 // CHECK-LABEL: define dso_local i32 @f_i32_edx()
55 // CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov edx, $$1", "={eax},~{edx},{{.*}}"
56 // CHECK: ret i32 %[[r]]
64 // CHECK-LABEL: define dso_local signext i16 @f_i16()
65 // CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov eax, $$1\0A\09mov edx, $$1", "=&{eax},~{edx},{{.*}}"
66 // CHECK: %[[r_i16:[^ ]*]] = trunc i32 %[[r]] to i16
67 // CHECK: ret i16 %[[r_i16]]
75 // CHECK-LABEL: define dso_local signext i8 @f_i8()
76 // CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov eax, $$1\0A\09mov edx, $$1", "=&{eax},~{edx},{{.*}}"
77 // CHECK: %[[r_i8:[^ ]*]] = trunc i32 %[[r]] to i8
78 // CHECK: ret i8 %[[r_i8]]
86 // CHECK-LABEL: define dso_local zeroext i1 @f_i1()
87 // CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov eax, $$1\0A\09mov edx, $$1", "=&{eax},~{edx},{{.*}}"
88 // CHECK: %[[r_i8:[^ ]*]] = trunc i32 %[[r]] to i8
89 // CHECK: store i8 %[[r_i8]], ptr %{{.*}}
90 // CHECK: %[[r_i1:[^ ]*]] = load i1, ptr %{{.*}}
91 // CHECK: ret i1 %[[r_i1]]
101 // CHECK-LABEL: define dso_local i32 @f_s4()
102 // CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov eax, $$16843009", "=&{eax},{{.*}}"
103 // CHECK: store i32 %[[r]], ptr %{{.*}}
104 // CHECK: %[[r_i32:[^ ]*]] = load i32, ptr %{{.*}}
105 // CHECK: ret i32 %[[r_i32]]
108 char a
, b
, c
, d
, e
, f
, g
, h
;
116 // CHECK-LABEL: define dso_local i64 @f_s8()
117 // CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov eax, $$16843009\0A\09mov edx, $$85", "=&A,{{.*}}"
118 // CHECK: store i64 %[[r]], ptr %{{.*}}
119 // CHECK: %[[r_i64:[^ ]*]] = load i64, ptr %{{.*}}
120 // CHECK: ret i64 %[[r_i64]]
127 // CHECK-LABEL: define dso_local noundef i32 @main()
128 // CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "xor eax, eax", "=&{eax},{{.*}}"
129 // CHECK: ret i32 %[[r]]