[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Jul 29 17:18:04 PDT 2005
Changes in directory llvm/lib/Target/X86:
X86ISelPattern.cpp updated: 1.159 -> 1.160
---
Log message:
Change the fp to integer code to not perform 2-byte stores followed by
1 byte loads and other operations. This is bad for store-forwarding on
common CPUs. We now do this:
fnstcw WORD PTR [%ESP]
mov %AX, WORD PTR [%ESP]
instead of:
fnstcw WORD PTR [%ESP]
mov %AL, BYTE PTR [%ESP + 1]
---
Diffs of the changes: (+4 -7)
X86ISelPattern.cpp | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
Index: llvm/lib/Target/X86/X86ISelPattern.cpp
diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.159 llvm/lib/Target/X86/X86ISelPattern.cpp:1.160
--- llvm/lib/Target/X86/X86ISelPattern.cpp:1.159 Fri Jul 29 19:05:54 2005
+++ llvm/lib/Target/X86/X86ISelPattern.cpp Fri Jul 29 19:17:52 2005
@@ -4332,20 +4332,17 @@
addFrameReference(BuildMI(BB, X86::FNSTCW16m, 4), CWFrameIdx);
// Load the old value of the high byte of the control word...
- unsigned HighPartOfCW = MakeReg(MVT::i8);
- addFrameReference(BuildMI(BB, X86::MOV8rm, 4, HighPartOfCW),
- CWFrameIdx, 1);
+ unsigned OldCW = MakeReg(MVT::i16);
+ addFrameReference(BuildMI(BB, X86::MOV16rm, 4, OldCW), CWFrameIdx);
// Set the high part to be round to zero...
- addFrameReference(BuildMI(BB, X86::MOV8mi, 5),
- CWFrameIdx, 1).addImm(12);
+ addFrameReference(BuildMI(BB, X86::MOV16mi, 5), CWFrameIdx).addImm(0xB7F);
// Reload the modified control word now...
addFrameReference(BuildMI(BB, X86::FLDCW16m, 4), CWFrameIdx);
// Restore the memory image of control word to original value
- addFrameReference(BuildMI(BB, X86::MOV8mr, 5),
- CWFrameIdx, 1).addReg(HighPartOfCW);
+ addFrameReference(BuildMI(BB, X86::MOV16mr, 5), CWFrameIdx).addReg(OldCW);
// Get the X86 opcode to use.
switch (N.getOpcode()) {
More information about the llvm-commits
mailing list