summaryrefslogtreecommitdiff
path: root/test/CodeGen/Hexagon
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-11-28 19:13:17 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-11-28 19:13:17 +0000
commita4de810dd51751e2102950fb57e55fba116b343c (patch)
treeed53f7ead62b3610bd422a7dbb42d5ceacd8d0ec /test/CodeGen/Hexagon
parent68e8f784889e71faaaaee497c5ed5ce139816b00 (diff)
[Hexagon] Make sure to zero-extend bytes before building a vector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319204 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Hexagon')
-rw-r--r--test/CodeGen/Hexagon/build-vector-v4i8-zext.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/CodeGen/Hexagon/build-vector-v4i8-zext.ll b/test/CodeGen/Hexagon/build-vector-v4i8-zext.ll
new file mode 100644
index 00000000000..b39426a723d
--- /dev/null
+++ b/test/CodeGen/Hexagon/build-vector-v4i8-zext.ll
@@ -0,0 +1,17 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+
+; Check that we generate zero-extends, instead of just shifting and oring
+; registers (which can contain sign-extended negative values).
+; CHECK: and(r{{[0-9]+}},#255)
+
+define i32 @fred(i8 %a0, i8 %a1, i8 %a2, i8 %a3) #0 {
+b4:
+ %v5 = insertelement <4 x i8> undef, i8 %a0, i32 0
+ %v6 = insertelement <4 x i8> %v5, i8 %a1, i32 1
+ %v7 = insertelement <4 x i8> %v6, i8 %a2, i32 2
+ %v8 = insertelement <4 x i8> %v7, i8 %a3, i32 3
+ %v9 = bitcast <4 x i8> %v8 to i32
+ ret i32 %v9
+}
+
+attributes #0 = { nounwind readnone }