diff options
author | Tim Shen <timshen91@gmail.com> | 2018-01-23 22:06:57 +0000 |
---|---|---|
committer | Tim Shen <timshen91@gmail.com> | 2018-01-23 22:06:57 +0000 |
commit | 7abe9887b0af5df201db93ce8ce97abafd0a363e (patch) | |
tree | 1b875a6c725b807abf9814e74a8b6cb4eb153016 /llvm/test/CodeGen/PowerPC/fp-int128-fp-combine.ll | |
parent | c4ed9ed27677555e55a66e9b12e8b40bcc67df44 (diff) | |
download | bcm5719-llvm-7abe9887b0af5df201db93ce8ce97abafd0a363e.tar.gz bcm5719-llvm-7abe9887b0af5df201db93ce8ce97abafd0a363e.zip |
[PPC] Avoid incorrect fp-i128-fp lowering.
Summary:
Fix an issue that's similar to what D41411 fixed:
float(__int128(float_var)) shouldn't be optimized to xscvdpsxds +
xscvsxdsp, as they mean (float)(int64_t)float_var.
Reviewers: jtony, hfinkel, echristo
Subscribers: sanjoy, nemanjai, hiraditya, llvm-commits, kbarton
Differential Revision: https://reviews.llvm.org/D42400
llvm-svn: 323270
Diffstat (limited to 'llvm/test/CodeGen/PowerPC/fp-int128-fp-combine.ll')
-rw-r--r-- | llvm/test/CodeGen/PowerPC/fp-int128-fp-combine.ll | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/PowerPC/fp-int128-fp-combine.ll b/llvm/test/CodeGen/PowerPC/fp-int128-fp-combine.ll new file mode 100644 index 00000000000..eff0c28e0f5 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/fp-int128-fp-combine.ll @@ -0,0 +1,25 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -O0 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s + +; xscvdpsxds should NOT be emitted, since it saturates the result down to i64. +define float @f_i128_f(float %v) { +; CHECK-LABEL: f_i128_f: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: mflr 0 +; CHECK-NEXT: std 0, 16(1) +; CHECK-NEXT: stdu 1, -32(1) +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: .cfi_offset lr, 16 +; CHECK-NEXT: bl __fixsfti +; CHECK-NEXT: nop +; CHECK-NEXT: bl __floattisf +; CHECK-NEXT: nop +; CHECK-NEXT: addi 1, 1, 32 +; CHECK-NEXT: ld 0, 16(1) +; CHECK-NEXT: mtlr 0 +; CHECK-NEXT: blr +entry: + %a = fptosi float %v to i128 + %b = sitofp i128 %a to float + ret float %b +} |