[llvm] db3c3fc - Simple check to ignore Inline asm fwait insertion (#101686)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 07:37:02 PDT 2024
Author: Temperatureblock
Date: 2024-08-12T22:36:58+08:00
New Revision: db3c3fc90a7c35dec504a454328ab619aa70830f
URL: https://github.com/llvm/llvm-project/commit/db3c3fc90a7c35dec504a454328ab619aa70830f
DIFF: https://github.com/llvm/llvm-project/commit/db3c3fc90a7c35dec504a454328ab619aa70830f.diff
LOG: Simple check to ignore Inline asm fwait insertion (#101686)
Just a simple check to ignore Inline asm fwait insertion
Fixes #101613
Added:
Modified:
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/pr59305.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index 7e2e97d387a83..39ba7ea777909 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -3591,10 +3591,10 @@ static bool isX87Reg(unsigned Reg) {
/// check if the instruction is X87 instruction
bool X86::isX87Instruction(MachineInstr &MI) {
- // Call defs X87 register, so we special case it here because
+ // Call and inlineasm defs X87 register, so we special case it here because
// otherwise calls are incorrectly flagged as x87 instructions
// as a result.
- if (MI.isCall())
+ if (MI.isCall() || MI.isInlineAsm())
return false;
for (const MachineOperand &MO : MI.operands()) {
if (!MO.isReg())
diff --git a/llvm/test/CodeGen/X86/pr59305.ll b/llvm/test/CodeGen/X86/pr59305.ll
index 46c9da5a51939..d8738081842a3 100644
--- a/llvm/test/CodeGen/X86/pr59305.ll
+++ b/llvm/test/CodeGen/X86/pr59305.ll
@@ -81,20 +81,17 @@ define double @bar(double %0) #0 {
; X64-NEXT: #APP
; X64-NEXT: ldmxcsr 0
; X64-NEXT: #NO_APP
-; X64-NEXT: wait
; X64-NEXT: movsd {{.*#+}} xmm2 = [1.0E+0,0.0E+0]
; X64-NEXT: movapd %xmm2, %xmm3
; X64-NEXT: divsd %xmm0, %xmm3
; X64-NEXT: #APP
; X64-NEXT: ldmxcsr 0
; X64-NEXT: #NO_APP
-; X64-NEXT: wait
; X64-NEXT: movapd %xmm2, %xmm1
; X64-NEXT: divsd %xmm0, %xmm1
; X64-NEXT: #APP
; X64-NEXT: ldmxcsr 0
; X64-NEXT: #NO_APP
-; X64-NEXT: wait
; X64-NEXT: divsd %xmm0, %xmm2
; X64-NEXT: movapd %xmm3, %xmm0
; X64-NEXT: callq fma at PLT
@@ -105,6 +102,7 @@ define double @bar(double %0) #0 {
; X86: # %bb.0:
; X86-NEXT: subl $28, %esp
; X86-NEXT: fldl {{[0-9]+}}(%esp)
+; X86-NEXT: wait
; X86-NEXT: #APP
; X86-NEXT: fldcw 0
; X86-NEXT: #NO_APP
More information about the llvm-commits
mailing list