aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/ConstProp/half.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/ConstProp/half.ll')
-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)
+