aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86ISelPattern.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-07-30 00:17:52 +0000
committerChris Lattner <sabre@nondot.org>2005-07-30 00:17:52 +0000
commita35e1dfd12b9eaa440af68c760394bef9ac17335 (patch)
tree8ca1a68d97f3d6ee63b65fb8c0de47c64b67d088 /lib/Target/X86/X86ISelPattern.cpp
parent169974856781a1ce27af9ce6220c390b20c9e6dd (diff)
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] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22559 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86ISelPattern.cpp')
-rw-r--r--lib/Target/X86/X86ISelPattern.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Target/X86/X86ISelPattern.cpp b/lib/Target/X86/X86ISelPattern.cpp
index 5913d8b19b..eef5783989 100644
--- a/lib/Target/X86/X86ISelPattern.cpp
+++ b/lib/Target/X86/X86ISelPattern.cpp
@@ -4332,20 +4332,17 @@ void ISel::Select(SDOperand N) {
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()) {