r280556 - (clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.
Yunzhong Gao via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 2 16:16:07 PDT 2016
Author: ygao
Date: Fri Sep 2 18:16:06 2016
New Revision: 280556
URL: http://llvm.org/viewvc/llvm-project?rev=280556&view=rev
Log:
(clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.
Clang tests for verifying the following syntaxes:
1. 0xNN and NNh are accepted as valid hexadecimal numbers, but 0xNNh is not.
0xNN and NNh may come with optional U or L suffix.
2. NNb is accepted as a valid binary (base-2) number, but 0bNN is not.
NNb may come with optional U or L suffix.
Differential Revision: https://reviews.llvm.org/D22112
Modified:
cfe/trunk/test/CodeGen/ms-inline-asm.c
cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp
cfe/trunk/test/Parser/ms-inline-asm.c
Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=280556&r1=280555&r2=280556&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Fri Sep 2 18:16:06 2016
@@ -47,7 +47,7 @@ void t6(void) {
void t7() {
__asm {
- int 0x2c ; } asm comments are fun! }{
+ int 0x2cU ; } asm comments are fun! }{
}
__asm {
{
@@ -56,7 +56,7 @@ void t7() {
}
__asm {}
// CHECK: t7
-// CHECK: call void asm sideeffect inteldialect "int $$0x2c", "~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call void asm sideeffect inteldialect "int $$0x2cU", "~{dirflag},~{fpsr},~{flags}"()
// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"()
}
@@ -171,8 +171,8 @@ void t17() {
// CHECK: t17
__asm _emit 0x4A
// CHECK: .byte 0x4A
- __asm _emit 0x43
-// CHECK: .byte 0x43
+ __asm _emit 0x43L
+// CHECK: .byte 0x43L
__asm _emit 0x4B
// CHECK: .byte 0x4B
__asm _EMIT 0x4B
@@ -219,11 +219,11 @@ void t20() {
void t21() {
__asm {
__asm push ebx
- __asm mov ebx, 0x07
+ __asm mov ebx, 07H
__asm pop ebx
}
// CHECK: t21
-// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, $$0x07\0A\09pop ebx", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, $$07H\0A\09pop ebx", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
}
extern void t22_helper(int x);
@@ -262,15 +262,15 @@ void t24() {
void t25() {
// CHECK: t25
__asm mov eax, 0ffffffffh
-// CHECK: mov eax, $$4294967295
- __asm mov eax, 0fh
+// CHECK: mov eax, $$0ffffffffh
+ __asm mov eax, 0fhU
// CHECK: mov eax, $$15
__asm mov eax, 0a2h
+// CHECK: mov eax, $$0a2h
+ __asm mov eax, 10100010b
+// CHECK: mov eax, $$10100010b
+ __asm mov eax, 10100010BU
// CHECK: mov eax, $$162
- __asm mov eax, 0xa2h
-// CHECK: mov eax, $$0xa2h
- __asm mov eax, 0xa2
-// CHECK: mov eax, $$0xa2
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
}
Modified: cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp?rev=280556&r1=280555&r2=280556&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp Fri Sep 2 18:16:06 2016
@@ -50,8 +50,8 @@ char f_i8() {
bool f_i1() {
__asm {
- mov eax, 1
- mov edx, 1
+ mov eax, 1L
+ mov edx, 1U
}
}
// CHECK-LABEL: define zeroext i1 @f_i1()
@@ -80,12 +80,12 @@ struct EightChars {
};
EightChars f_s8() {
__asm {
- mov eax, 0x01010101
- mov edx, 0x01010101
+ mov eax, 01010101h
+ mov edx, 01010101b
}
}
// CHECK-LABEL: define i64 @f_s8()
-// CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov eax, $$0x01010101\0A\09mov edx, $$0x01010101", "=A,~{eax},{{.*}}"
+// CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov eax, $$01010101h\0A\09mov edx, $$01010101b", "=A,~{eax},{{.*}}"
// CHECK: store i64 %[[r]], i64* %{{.*}}
// CHECK: %[[r_i64:[^ ]*]] = load i64, i64* %{{.*}}
// CHECK: ret i64 %[[r_i64]]
Modified: cfe/trunk/test/Parser/ms-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/ms-inline-asm.c?rev=280556&r1=280555&r2=280556&view=diff
==============================================================================
--- cfe/trunk/test/Parser/ms-inline-asm.c (original)
+++ cfe/trunk/test/Parser/ms-inline-asm.c Fri Sep 2 18:16:06 2016
@@ -7,9 +7,9 @@
#define M2 int
void t1(void) { M }
-void t2(void) { __asm int 0x2c }
-void t3(void) { __asm M2 0x2c }
-void t4(void) { __asm mov eax, fs:[0x10] }
+void t2(void) { __asm int 2ch }
+void t3(void) { __asm M2 2ch }
+void t4(void) { __asm mov eax, fs:[10h] }
void t5() {
__asm {
int 0x2c ; } asm comments are fun! }{
@@ -26,7 +26,7 @@ int t6() {
void t7() {
__asm {
push ebx
- mov ebx, 0x07
+ mov ebx, 07h
pop ebx
}
}
More information about the cfe-commits
mailing list