mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-15 09:33:39 +00:00
. "fptosi" and "fptoui" IR instructions are defined with round-to-zero rounding mode. . Currently for AVX mode for <4xdouble> and <8xdouble> the "VCVTPD2DQ.128" and "VCVTPD2DQ.256" instructions are selected (for .fp_to_sint. DAG node operation ) by AVX codegen. However they use round-to-nearest-even rounding mode. . Consequently, the conversion produces incorrect numbers. The fix is to replace selection of VCVTPD2DQ instructions with VCVTTPD2DQ instructions. The latter use truncate (i.e. round-to-zero) rounding mode. As .fp_to_sint. DAG node operation is used only for lowering of "fptosi" and "fptoui" IR instructions, the fix in X86InstrSSE.td definition file doesn.t have an impact on other LLVM flows. The patch includes changes in the .td file, LIT test for the changes and a fix in a legacy LIT test (which produced asm code conflicting with LLVN IR spec). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149056 91177308-0d34-0410-b5e6-96231b3b80d8
20 lines
490 B
LLVM
Executable File
20 lines
490 B
LLVM
Executable File
; RUN: llc < %s -mtriple=i386-apple-darwin10 -mcpu=corei7-avx -mattr=+avx | FileCheck %s
|
|
|
|
;; Check that FP_TO_SINT and FP_TO_UINT generate convert with truncate
|
|
|
|
; CHECK: test1:
|
|
; CHECK: vcvttpd2dqy
|
|
; CHECK: ret
|
|
; CHECK: test2:
|
|
; CHECK: vcvttpd2dqy
|
|
; CHECK: ret
|
|
|
|
define <4 x i8> @test1(<4 x double> %d) {
|
|
%c = fptoui <4 x double> %d to <4 x i8>
|
|
ret <4 x i8> %c
|
|
}
|
|
define <4 x i8> @test2(<4 x double> %d) {
|
|
%c = fptosi <4 x double> %d to <4 x i8>
|
|
ret <4 x i8> %c
|
|
}
|