aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/ConstProp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2013-02-06 22:43:31 +0000
committerOwen Anderson <resistor@mac.com>2013-02-06 22:43:31 +0000
commit42258e0ea8781dd29cae4b1a6eb54d8c70dcea0b (patch)
treeec487396d7fb2611536dd527c6e8d133cacad199 /test/Transforms/ConstProp
parentbfa18fdfbf01d790ac6f91f28d73680ced4c6663 (diff)
downloadexternal_llvm-42258e0ea8781dd29cae4b1a6eb54d8c70dcea0b.zip
external_llvm-42258e0ea8781dd29cae4b1a6eb54d8c70dcea0b.tar.gz
external_llvm-42258e0ea8781dd29cae4b1a6eb54d8c70dcea0b.tar.bz2
Signficantly generalize our ability to constant fold floating point intrinsics, including ones on half types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174555 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ConstProp')
-rw-r--r--test/Transforms/ConstProp/half.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/Transforms/ConstProp/half.ll b/test/Transforms/ConstProp/half.ll
new file mode 100644
index 0000000..3d246d8
--- /dev/null
+++ b/test/Transforms/ConstProp/half.ll
@@ -0,0 +1,42 @@
+; RUN: opt -constprop -S < %s | FileCheck %s
+
+; CHECK: fabs_call
+define half @fabs_call() {
+; CHECK: ret half 0xH5140
+ %x = call half @llvm.fabs.f16(half -42.0)
+ ret half %x
+}
+declare half @llvm.fabs.f16(half %x)
+
+; CHECK: exp_call
+define half @exp_call() {
+; CHECK: ret half 0xH4170
+ %x = call half @llvm.exp.f16(half 1.0)
+ ret half %x
+}
+declare half @llvm.exp.f16(half %x)
+
+; CHECK: sqrt_call
+define half @sqrt_call() {
+; CHECK: ret half 0xH4000
+ %x = call half @llvm.sqrt.f16(half 4.0)
+ ret half %x
+}
+declare half @llvm.sqrt.f16(half %x)
+
+; CHECK: floor_call
+define half @floor_call() {
+; CHECK: ret half 0xH4000
+ %x = call half @llvm.floor.f16(half 2.5)
+ ret half %x
+}
+declare half @llvm.floor.f16(half %x)
+
+; CHECK: pow_call
+define half @pow_call() {
+; CHECK: ret half 0xH4400
+ %x = call half @llvm.pow.f16(half 2.0, half 2.0)
+ ret half %x
+}
+declare half @llvm.pow.f16(half %x, half %y)
+