summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Generic
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2010-06-15 20:29:05 +0000
committerMon P Wang <wangmp@apple.com>2010-06-15 20:29:05 +0000
commit7a84689cc58d7fef9de064e86afef4bb7c32a59c (patch)
tree749017590caf28091bed7d9909283e274585dee0 /llvm/test/CodeGen/Generic
parent9858ed5b699cea0ad8edcbe0820f3cee5112113e (diff)
downloadbcm5719-llvm-7a84689cc58d7fef9de064e86afef4bb7c32a59c.tar.gz
bcm5719-llvm-7a84689cc58d7fef9de064e86afef4bb7c32a59c.zip
Fixed vector widening of binary instructions that can trap. Patch by Visa Putkinen!
llvm-svn: 106038
Diffstat (limited to 'llvm/test/CodeGen/Generic')
-rw-r--r--llvm/test/CodeGen/Generic/v-binop-widen.ll8
-rw-r--r--llvm/test/CodeGen/Generic/v-binop-widen2.ll37
2 files changed, 45 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Generic/v-binop-widen.ll b/llvm/test/CodeGen/Generic/v-binop-widen.ll
new file mode 100644
index 00000000000..89aa3366459
--- /dev/null
+++ b/llvm/test/CodeGen/Generic/v-binop-widen.ll
@@ -0,0 +1,8 @@
+; RUN: llc -march=x86 %s
+
+%vec = type <9 x float>
+define %vec @vecdiv( %vec %p1, %vec %p2)
+{
+ %result = fdiv %vec %p1, %p2
+ ret %vec %result
+}
diff --git a/llvm/test/CodeGen/Generic/v-binop-widen2.ll b/llvm/test/CodeGen/Generic/v-binop-widen2.ll
new file mode 100644
index 00000000000..c494ca16f66
--- /dev/null
+++ b/llvm/test/CodeGen/Generic/v-binop-widen2.ll
@@ -0,0 +1,37 @@
+; RUN: llvm-as < %s | lli
+
+%vec = type <6 x float>
+
+define %vec @vecdiv( %vec %p1, %vec %p2)
+{
+ %result = fdiv %vec %p1, %p2
+ ret %vec %result
+}
+
+@a = constant %vec < float 2.0, float 4.0, float 8.0, float 16.0, float 32.0, float 64.0 >
+@b = constant %vec < float 2.0, float 2.0, float 2.0, float 2.0, float 2.0, float 2.0 >
+
+; Expected result: < 1.0, 2.0, 4.0, ..., 2.0^(n-1) >
+; main() returns 0 if the result is expected and 1 otherwise
+define i32 @main() nounwind {
+entry:
+ %avec = load %vec* @a
+ %bvec = load %vec* @b
+
+ %res = call %vec @vecdiv(%vec %avec, %vec %bvec)
+ br label %loop
+loop:
+ %idx = phi i32 [0, %entry], [%nextInd, %looptail]
+ %expected = phi float [1.0, %entry], [%nextExpected, %looptail]
+ %elem = extractelement %vec %res, i32 %idx
+ %expcmp = fcmp oeq float %elem, %expected
+ br i1 %expcmp, label %looptail, label %return
+looptail:
+ %nextExpected = fmul float %expected, 2.0
+ %nextInd = add i32 %idx, 1
+ %cmp = icmp slt i32 %nextInd, 6
+ br i1 %cmp, label %loop, label %return
+return:
+ %retval = phi i32 [0, %looptail], [1, %loop]
+ ret i32 %retval
+}
OpenPOWER on IntegriCloud