xref: /llvm-project/llvm/test/CodeGen/PowerPC/negative-integer-fp-libcall.ll (revision 90c14748638f1e10e31173b145fdbb5c4529c922)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2; RUN: llc -O1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s
3
4; Test that a negative parameter smaller than 64 bits (e.g., int)
5; is correctly implemented with sign-extension when passed to
6; a floating point libcall.
7
8define double @ldexp_test(ptr %a, ptr %b) nounwind {
9; CHECK-LABEL: ldexp_test:
10; CHECK:       # %bb.0:
11; CHECK-NEXT:    mflr 0
12; CHECK-NEXT:    stdu 1, -112(1)
13; CHECK-NEXT:    std 0, 128(1)
14; CHECK-NEXT:    lfd 1, 0(3)
15; CHECK-NEXT:    lwa 4, 0(4)
16; CHECK-NEXT:    bl ldexp
17; CHECK-NEXT:    nop
18; CHECK-NEXT:    addi 1, 1, 112
19; CHECK-NEXT:    ld 0, 16(1)
20; CHECK-NEXT:    mtlr 0
21; CHECK-NEXT:    blr
22  %base = load double, ptr %a
23  %exp = load i32, ptr %b
24  %call = call double @llvm.ldexp.f64.i32(double %base, i32 signext %exp)
25  ret double %call
26}
27