[X86][FastISel] Don't force Nearest-Even rounding for VCVTPS2PH, use MXCSR.

FastISel counterpart to r259448.

llvm-svn: 259449
This commit is contained in:
Ahmed Bougacha 2016-02-02 01:44:03 +00:00
parent 55c6682ae2
commit 68a8efa374
2 changed files with 5 additions and 3 deletions

View File

@ -2294,8 +2294,10 @@ bool X86FastISel::fastLowerIntrinsicCall(const IntrinsicInst *II) {
// register class VR128 by method 'constrainOperandRegClass' which is
// directly called by 'fastEmitInst_ri'.
// Instruction VCVTPS2PHrr takes an extra immediate operand which is
// used to provide rounding control.
InputReg = fastEmitInst_ri(X86::VCVTPS2PHrr, RC, InputReg, false, 0);
// used to provide rounding control: use MXCSR.RC, encoded as 0b100.
// It's consistent with the other FP instructions, which are usually
// controlled by MXCSR.
InputReg = fastEmitInst_ri(X86::VCVTPS2PHrr, RC, InputReg, false, 4);
// Move the lower 32-bits of ResultReg to another register of class GR32.
ResultReg = createResultReg(&X86::GR32RegClass);

View File

@ -4,7 +4,7 @@
define i16 @test_fp32_to_fp16(float %a) {
; CHECK-LABEL: test_fp32_to_fp16:
; CHECK: vcvtps2ph $0, %xmm0, %xmm0
; CHECK: vcvtps2ph $4, %xmm0, %xmm0
; CHECK-NEXT: vmovd %xmm0, %eax
; CHECK-NEXT: retq
entry: