diff options
author | Eli Friedman <efriedma@quicinc.com> | 2019-10-31 12:06:18 -0700 |
---|---|---|
committer | Eli Friedman <efriedma@quicinc.com> | 2019-11-08 12:43:21 -0800 |
commit | 5df3a87224ef5843a3374a5b87e57495b3f714c4 (patch) | |
tree | 96954d5ac4aa1ff27469675a0bbe3ad310550c93 /llvm/test | |
parent | 9f08ce0d2197d4f163dfa4633eae2347ce8fc881 (diff) | |
download | bcm5719-llvm-5df3a87224ef5843a3374a5b87e57495b3f714c4.tar.gz bcm5719-llvm-5df3a87224ef5843a3374a5b87e57495b3f714c4.zip |
[AArch64][X86] Don't assume __powidf2 is available on Windows.
We had some code for this for 32-bit ARM, but this doesn't really need
to be in target-specific code; generalize it.
(I think this started showing up recently because we added an
optimization that converts pow to powi.)
Differential Revision: https://reviews.llvm.org/D69013
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/AArch64/powi-windows.ll | 46 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/powi-windows.ll | 46 |
2 files changed, 92 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/powi-windows.ll b/llvm/test/CodeGen/AArch64/powi-windows.ll new file mode 100644 index 00000000000..859d772b447 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/powi-windows.ll @@ -0,0 +1,46 @@ +; RUN: llc -mtriple aarch64-windows < %s | FileCheck %s + +declare double @llvm.powi.f64(double, i32) +declare float @llvm.powi.f32(float, i32) + +define double @d(double %d, i32 %i) { +entry: + %0 = tail call double @llvm.powi.f64(double %d, i32 %i) + ret double %0 +} + +; CHECK-LABEL: d: +; CHECK: scvtf d1, w0 +; CHECK-NEXT: b pow + +define float @f(float %f, i32 %i) { +entry: + %0 = tail call float @llvm.powi.f32(float %f, i32 %i) + ret float %0 +} + +; CHECK-LABEL: f: +; CHECK: scvtf s1, w0 +; CHECK-NEXT: b powf + +define float @g(double %d, i32 %i) { +entry: + %0 = tail call double @llvm.powi.f64(double %d, i32 %i) + %conv = fptrunc double %0 to float + ret float %conv +} + +; CHECK-LABEL: g: +; CHECK: scvtf d1, w0 +; CHECK-NEXT: bl pow + +define double @h(float %f, i32 %i) { +entry: + %0 = tail call float @llvm.powi.f32(float %f, i32 %i) + %conv = fpext float %0 to double + ret double %conv +} + +; CHECK-LABEL: h: +; CHECK: scvtf s1, w0 +; CHECK-NEXT: bl powf diff --git a/llvm/test/CodeGen/X86/powi-windows.ll b/llvm/test/CodeGen/X86/powi-windows.ll new file mode 100644 index 00000000000..804071ba123 --- /dev/null +++ b/llvm/test/CodeGen/X86/powi-windows.ll @@ -0,0 +1,46 @@ +; RUN: llc -mtriple x86_64-windows < %s | FileCheck %s + +declare double @llvm.powi.f64(double, i32) +declare float @llvm.powi.f32(float, i32) + +define double @d(double %d, i32 %i) { +entry: + %0 = tail call double @llvm.powi.f64(double %d, i32 %i) + ret double %0 +} + +; CHECK-LABEL: d: +; CHECK: cvtsi2sd %edx, %xmm1 +; CHECK-NEXT: jmp pow + +define float @f(float %f, i32 %i) { +entry: + %0 = tail call float @llvm.powi.f32(float %f, i32 %i) + ret float %0 +} + +; CHECK-LABEL: f: +; CHECK: cvtsi2ss %edx, %xmm1 +; CHECK-NEXT: jmp powf + +define float @g(double %d, i32 %i) { +entry: + %0 = tail call double @llvm.powi.f64(double %d, i32 %i) + %conv = fptrunc double %0 to float + ret float %conv +} + +; CHECK-LABEL: g: +; CHECK: cvtsi2sd %edx, %xmm1 +; CHECK-NEXT: callq pow + +define double @h(float %f, i32 %i) { +entry: + %0 = tail call float @llvm.powi.f32(float %f, i32 %i) + %conv = fpext float %0 to double + ret double %conv +} + +; CHECK-LABEL: h: +; CHECK: cvtsi2ss %edx, %xmm1 +; CHECK-NEXT: callq powf |