MaskRay created this revision. MaskRay added reviewers: alvinhochun, epastor, hans, thakis, ayzhao. Herald added subscribers: pengfei, hiraditya. Herald added a project: All. MaskRay requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits.
The AOK_SizeDirective part from 5b37c181291210bedfbb7a6af5d51229f3652ef0 (2014-08) seems unneeded nowadays (the root cause has likely been fixed elsewhere). The part abuses that `call dword ptr foo` assembles the same way as `call foo` in Intel syntax, which is going to be fixed (changed) by D149579 <https://reviews.llvm.org/D149579>. The generated object files for CodeGen/ms-inline-asm-functions.c, CodeGen/ms-inline-asm-functions.c, and CodeGenCXX/ms-inline-asm-fields.cpp are unchanged with just this patch. When D149579 <https://reviews.llvm.org/D149579> is subsequently applied, the FIXME part of `kptr` in CodeGen/ms-inline-asm-functions.c will be fixed. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D149695 Files: clang/test/CodeGen/mozilla-ms-inline-asm.c clang/test/CodeGen/ms-inline-asm-64.c clang/test/CodeGen/ms-inline-asm.c clang/test/CodeGen/ms-inline-asm.cpp clang/test/CodeGen/ms_this.cpp clang/test/CodeGenCXX/ms-inline-asm-fields.cpp llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
Index: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp =================================================================== --- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1748,12 +1748,6 @@ // If we found a decl other than a VarDecl, then assume it is a FuncDecl or // some other label reference. if (Info.isKind(InlineAsmIdentifierInfo::IK_Label)) { - // Insert an explicit size if the user didn't have one. - if (!Size) { - Size = getPointerWidth(); - InstInfo->AsmRewrites->emplace_back(AOK_SizeDirective, Start, - /*Len=*/0, Size); - } // Create an absolute memory reference in order to match against // instructions taking a PC relative operand. Operands.push_back(X86Operand::CreateMem(getPointerWidth(), Disp, Start, Index: clang/test/CodeGenCXX/ms-inline-asm-fields.cpp =================================================================== --- clang/test/CodeGenCXX/ms-inline-asm-fields.cpp +++ clang/test/CodeGenCXX/ms-inline-asm-fields.cpp @@ -53,4 +53,4 @@ // CHECK: %[[P:.*]] = alloca %"struct.make_storage_type<false>::type", align 4 // CHECK: %[[B:.*]] = getelementptr inbounds %"struct.make_storage_type<false>::type", ptr %[[P]], i32 0, i32 0 // CHECK: %[[X:.*]] = getelementptr inbounds %"struct.make_storage_type<false>::type::B", ptr %[[B]], i32 0, i32 1 -// CHECK: call void asm sideeffect inteldialect "mov edx, dword ptr $0", "*m,~{edx},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %[[X]]) +// CHECK: call void asm sideeffect inteldialect "mov edx, $0", "*m,~{edx},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %[[X]]) Index: clang/test/CodeGen/ms_this.cpp =================================================================== --- clang/test/CodeGen/ms_this.cpp +++ clang/test/CodeGen/ms_this.cpp @@ -20,7 +20,7 @@ mov rax,[this] // CHECK: [[THIS_ADDR_T2:%.+]] = alloca ptr // CHECK: [[THIS1_T2:%.+]] = load ptr, ptr [[THIS_ADDR_T2]], - // CHECK: call void asm sideeffect inteldialect "mov rax,qword ptr $1{{.*}}ptr [[THIS1_T2]] + // CHECK: call void asm sideeffect inteldialect "mov rax,$1\0A\09mov rbx,[rax]\0A\09mov $0, rbx", "=*m,m,~{rax},~{rbx},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(double) %num, ptr [[THIS1_T2]]) mov rbx,[rax] mov num, rbx }; @@ -33,7 +33,7 @@ mov rax,[this] // CHECK: [[THIS_ADDR_T1:%.+]] = alloca ptr // CHECK: [[THIS1_T1:%.+]] = load ptr, ptr [[THIS_ADDR_T1]], - // CHECK: call void asm sideeffect inteldialect "mov rax,qword ptr $1{{.*}}ptr [[THIS1_T1]] + // CHECK: call void asm sideeffect inteldialect "mov rax,$1{{.*}}ptr [[THIS1_T1]] mov rbx,[rax] mov num, rbx }; @@ -46,7 +46,7 @@ __asm mov rax, [this] // CHECK: [[THIS_ADDR_S:%.+]] = alloca ptr // CHECK: [[THIS1_S:%.+]] = load ptr, ptr [[THIS_ADDR_S]], - // CHECK: call void asm sideeffect inteldialect "mov rax, qword ptr $0{{.*}}ptr [[THIS1_S]] + // CHECK: call void asm sideeffect inteldialect "mov rax, $0{{.*}}ptr [[THIS1_S]] } } f3; Index: clang/test/CodeGen/ms-inline-asm.cpp =================================================================== --- clang/test/CodeGen/ms-inline-asm.cpp +++ clang/test/CodeGen/ms-inline-asm.cpp @@ -109,7 +109,7 @@ __asm mov x, eax // CHECK: call void asm sideeffect inteldialect // CHECK-SAME: push $0 - // CHECK-SAME: call dword ptr ${2:P} + // CHECK-SAME: call ${2:P} // CHECK-SAME: mov $1, eax // CHECK-SAME: "=*m,=*m,*m,~{esp},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %y, ptr elementtype(i32) %x, ptr elementtype(i32 (float)) @_ZN2T5IiE6createIfEEiT_) } Index: clang/test/CodeGen/ms-inline-asm.c =================================================================== --- clang/test/CodeGen/ms-inline-asm.c +++ clang/test/CodeGen/ms-inline-asm.c @@ -312,7 +312,7 @@ void t24(void) { __asm call t24_helper // CHECK: t24 -// CHECK: call void asm sideeffect inteldialect "call dword ptr ${0:P}", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void ()) @t24_helper) +// CHECK: call void asm sideeffect inteldialect "call ${0:P}", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void ()) @t24_helper) } void t25(void) { @@ -684,7 +684,7 @@ void call_clobber(void) { __asm call t41 // CHECK-LABEL: define{{.*}} void @call_clobber - // CHECK: call void asm sideeffect inteldialect "call dword ptr ${0:P}", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void (i16)) @t41) + // CHECK: call void asm sideeffect inteldialect "call ${0:P}", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void (i16)) @t41) } void xgetbv(void) { Index: clang/test/CodeGen/ms-inline-asm-64.c =================================================================== --- clang/test/CodeGen/ms-inline-asm-64.c +++ clang/test/CodeGen/ms-inline-asm-64.c @@ -68,7 +68,7 @@ } // CHECK: t5 // CHECK: call void asm sideeffect inteldialect - // CHECK-SAME: call qword ptr ${0:P} - // CHECK-SAME: jmp qword ptr ${1:P} + // CHECK-SAME: call ${0:P} + // CHECK-SAME: jmp ${1:P} // CHECK-SAME: "*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void (...)) @bar, ptr elementtype(void (...)) @bar) } Index: clang/test/CodeGen/mozilla-ms-inline-asm.c =================================================================== --- clang/test/CodeGen/mozilla-ms-inline-asm.c +++ clang/test/CodeGen/mozilla-ms-inline-asm.c @@ -27,7 +27,7 @@ // CHECK-SAME: sub esp,eax // CHECK-SAME: mov ecx,esp // CHECK-SAME: push $0 -// CHECK-SAME: call dword ptr ${2:P} +// CHECK-SAME: call ${2:P} // CHECK-SAME: {{.*}}__MSASMLABEL_.${:uid}__noparams: // CHECK-SAME: mov ecx,$3 // CHECK-SAME: push ecx
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits