aboutsummaryrefslogtreecommitdiffstats
path: root/test/Assembler
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2012-05-24 15:59:06 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2012-05-24 15:59:06 +0000
commit057beb8d4fe8d5dad98ad80a49a649730c3a3eb0 (patch)
tree48e33d7c92b9abb8e79b152d07fef085fcc9b061 /test/Assembler
parent91bf23e6b7b9b4a00ebc73d4136a3b985581002a (diff)
downloadexternal_llvm-057beb8d4fe8d5dad98ad80a49a649730c3a3eb0.zip
external_llvm-057beb8d4fe8d5dad98ad80a49a649730c3a3eb0.tar.gz
external_llvm-057beb8d4fe8d5dad98ad80a49a649730c3a3eb0.tar.bz2
Add half support to LLVM (for OpenCL)
Submitted by: Anton Lokhmotov <Anton.Lokhmotov@arm.com> Approved by: o Anton Korobeynikov o Micah Villmow o David Neto git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157393 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Assembler')
-rw-r--r--test/Assembler/half-constprop.ll17
-rw-r--r--test/Assembler/half-conv.ll13
-rw-r--r--test/Assembler/half.ll8
3 files changed, 38 insertions, 0 deletions
diff --git a/test/Assembler/half-constprop.ll b/test/Assembler/half-constprop.ll
new file mode 100644
index 0000000..03ccdda
--- /dev/null
+++ b/test/Assembler/half-constprop.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as < %s | opt -O3 | llvm-dis | FileCheck %s
+; Testing half constant propagation.
+
+define half @abc() nounwind {
+entry:
+ %a = alloca half, align 2
+ %b = alloca half, align 2
+ %.compoundliteral = alloca float, align 4
+ store half 0xH4200, half* %a, align 2
+ store half 0xH4B9A, half* %b, align 2
+ %tmp = load half* %a, align 2
+ %tmp1 = load half* %b, align 2
+ %add = fadd half %tmp, %tmp1
+; CHECK: 0xH4C8D
+ ret half %add
+}
+
diff --git a/test/Assembler/half-conv.ll b/test/Assembler/half-conv.ll
new file mode 100644
index 0000000..bf9ae57
--- /dev/null
+++ b/test/Assembler/half-conv.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-as < %s | opt -O3 | llvm-dis | FileCheck %s
+; Testing half to float conversion.
+
+define float @abc() nounwind {
+entry:
+ %a = alloca half, align 2
+ %.compoundliteral = alloca float, align 4
+ store half 0xH4C8D, half* %a, align 2
+ %tmp = load half* %a, align 2
+ %conv = fpext half %tmp to float
+; CHECK: 0x4032340000000000
+ ret float %conv
+}
diff --git a/test/Assembler/half.ll b/test/Assembler/half.ll
new file mode 100644
index 0000000..63ad392
--- /dev/null
+++ b/test/Assembler/half.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+; Basic smoke test for half type.
+
+; CHECK: define half @halftest
+define half @halftest(half %A0) {
+; CHECK: ret half %A0
+ ret half %A0
+}