diff options
author | Ana Pazos <apazos@codeaurora.org> | 2014-02-18 20:31:05 +0000 |
---|---|---|
committer | Ana Pazos <apazos@codeaurora.org> | 2014-02-18 20:31:05 +0000 |
commit | a3de371b531a5667e2db3eb0cb1c8b9fc55941e4 (patch) | |
tree | 8705153ab9b51172c3d1c9125dd60f35f8b3b4b2 | |
parent | aa43604648e3ffc400dbcc1adec003c096eb76ca (diff) | |
download | llvm-a3de371b531a5667e2db3eb0cb1c8b9fc55941e4.tar.gz llvm-a3de371b531a5667e2db3eb0cb1c8b9fc55941e4.tar.bz2 llvm-a3de371b531a5667e2db3eb0cb1c8b9fc55941e4.tar.xz |
[AArch64] Expanded sin, cos, pow with FP vector types inputs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201601 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/AArch64/AArch64ISelLowering.cpp | 10 | ||||
-rw-r--r-- | test/CodeGen/AArch64/sincospow-vector-expansion.ll | 96 |
2 files changed, 106 insertions, 0 deletions
diff --git a/lib/Target/AArch64/AArch64ISelLowering.cpp b/lib/Target/AArch64/AArch64ISelLowering.cpp index f525130be2..2e7235d478 100644 --- a/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -520,6 +520,16 @@ AArch64TargetLowering::AArch64TargetLowering(AArch64TargetMachine &TM) // do such optimization in the future. setOperationAction(ISD::MUL, MVT::v1i64, Expand); setOperationAction(ISD::MUL, MVT::v2i64, Expand); + + setOperationAction(ISD::FCOS, MVT::v2f64, Expand); + setOperationAction(ISD::FCOS, MVT::v4f32, Expand); + setOperationAction(ISD::FCOS, MVT::v2f32, Expand); + setOperationAction(ISD::FSIN, MVT::v2f64, Expand); + setOperationAction(ISD::FSIN, MVT::v4f32, Expand); + setOperationAction(ISD::FSIN, MVT::v2f32, Expand); + setOperationAction(ISD::FPOW, MVT::v2f64, Expand); + setOperationAction(ISD::FPOW, MVT::v4f32, Expand); + setOperationAction(ISD::FPOW, MVT::v2f32, Expand); } setTargetDAGCombine(ISD::SETCC); diff --git a/test/CodeGen/AArch64/sincospow-vector-expansion.ll b/test/CodeGen/AArch64/sincospow-vector-expansion.ll new file mode 100644 index 0000000000..259a55ecd0 --- /dev/null +++ b/test/CodeGen/AArch64/sincospow-vector-expansion.ll @@ -0,0 +1,96 @@ +; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s + + +define <2 x float> @test_cos_v2f64(<2 x double> %v1) { +; CHECK-LABEL: test_cos_v2f64: +; CHECK: bl cos +; CHECK: bl cos + %1 = call <2 x double> @llvm.cos.v2f64(<2 x double> %v1) + %2 = fptrunc <2 x double> %1 to <2 x float> + ret <2 x float> %2 +} + +define <2 x float> @test_sin_v2f64(<2 x double> %v1) { +; CHECK-LABEL: test_sin_v2f64: +; CHECK: bl sin +; CHECK: bl sin + %1 = call <2 x double> @llvm.sin.v2f64(<2 x double> %v1) + %2 = fptrunc <2 x double> %1 to <2 x float> + ret <2 x float> %2 +} + +define <2 x float> @test_pow_v2f64(<2 x double> %v1, <2 x double> %v2) { +; CHECK-LABEL: test_pow_v2f64: +; CHECK: bl pow +; CHECK: bl pow + %1 = call <2 x double> @llvm.pow.v2f64(<2 x double> %v1, <2 x double> %v2) + %2 = fptrunc <2 x double> %1 to <2 x float> + ret <2 x float> %2 +} + +declare <2 x double> @llvm.cos.v2f64(<2 x double>) +declare <2 x double> @llvm.sin.v2f64(<2 x double>) +declare <2 x double> @llvm.pow.v2f64(<2 x double>, <2 x double>) + +define <2 x float> @test_cos_v2f32(<2 x float> %v1) { +; CHECK-LABEL: test_cos_v2f32: +; CHECK: bl cos +; CHECK: bl cos + %1 = call <2 x float> @llvm.cos.v2f32(<2 x float> %v1) + ret <2 x float> %1 +} + +define <2 x float> @test_sin_v2f32(<2 x float> %v1) { +; CHECK-LABEL: test_sin_v2f32: +; CHECK: bl sin +; CHECK: bl sin + %1 = call <2 x float> @llvm.sin.v2f32(<2 x float> %v1) + ret <2 x float> %1 +} + +define <2 x float> @test_pow_v2f32(<2 x float> %v1, <2 x float> %v2) { +; CHECK-LABEL: test_pow_v2f32: +; CHECK: bl pow +; CHECK: bl pow + %1 = call <2 x float> @llvm.pow.v2f32(<2 x float> %v1, <2 x float> %v2) + ret <2 x float> %1 +} + +declare <2 x float> @llvm.cos.v2f32(<2 x float>) +declare <2 x float> @llvm.sin.v2f32(<2 x float>) +declare <2 x float> @llvm.pow.v2f32(<2 x float>, <2 x float>) + +define <4 x float> @test_cos_v4f32(<4 x float> %v1) { +; CHECK-LABEL: test_cos_v4f32: +; CHECK: bl cos +; CHECK: bl cos +; CHECK: bl cos +; CHECK: bl cos + %1 = call <4 x float> @llvm.cos.v4f32(<4 x float> %v1) + ret <4 x float> %1 +} + +define <4 x float> @test_sin_v4f32(<4 x float> %v1) { +; CHECK-LABEL: test_sin_v4f32: +; CHECK: bl sin +; CHECK: bl sin +; CHECK: bl sin +; CHECK: bl sin + %1 = call <4 x float> @llvm.sin.v4f32(<4 x float> %v1) + ret <4 x float> %1 +} + +define <4 x float> @test_pow_v4f32(<4 x float> %v1, <4 x float> %v2) { +; CHECK-LABEL: test_pow_v4f32: +; CHECK: bl pow +; CHECK: bl pow +; CHECK: bl pow +; CHECK: bl pow + %1 = call <4 x float> @llvm.pow.v4f32(<4 x float> %v1, <4 x float> %v2) + ret <4 x float> %1 +} + +declare <4 x float> @llvm.cos.v4f32(<4 x float>) +declare <4 x float> @llvm.sin.v4f32(<4 x float>) +declare <4 x float> @llvm.pow.v4f32(<4 x float>, <4 x float>) + |