[llvm] c55b609 - [Hexagon] Fix bad SDNodeXForm

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 4 08:43:16 PST 2021


Author: Krzysztof Parzyszek
Date: 2021-01-04T10:43:01-06:00
New Revision: c55b609b777d59b4c174842ae87784626c2a4738

URL: https://github.com/llvm/llvm-project/commit/c55b609b777d59b4c174842ae87784626c2a4738
DIFF: https://github.com/llvm/llvm-project/commit/c55b609b777d59b4c174842ae87784626c2a4738.diff

LOG: [Hexagon] Fix bad SDNodeXForm

Fixes https://llvm.org/PR48651

Added: 
    llvm/test/CodeGen/Hexagon/isel-splat-vector-neg-i8.ll

Modified: 
    llvm/lib/Target/Hexagon/HexagonPatterns.td

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonPatterns.td b/llvm/lib/Target/Hexagon/HexagonPatterns.td
index fa91f7a31b14..d216c511a994 100644
--- a/llvm/lib/Target/Hexagon/HexagonPatterns.td
+++ b/llvm/lib/Target/Hexagon/HexagonPatterns.td
@@ -232,8 +232,8 @@ def NegImm32: SDNodeXForm<imm, [{
 def SplatB: SDNodeXForm<imm, [{
   uint32_t V = N->getZExtValue();
   assert(isUInt<8>(V) || V >> 8 == 0xFFFFFF);
-  uint32_t S = V << 24 | V << 16 | V << 8 | V;
   V &= 0xFF;
+  uint32_t S = V << 24 | V << 16 | V << 8 | V;
   return CurDAG->getTargetConstant(S, SDLoc(N), MVT::i32);
 }]>;
 

diff  --git a/llvm/test/CodeGen/Hexagon/isel-splat-vector-neg-i8.ll b/llvm/test/CodeGen/Hexagon/isel-splat-vector-neg-i8.ll
new file mode 100644
index 000000000000..9bd5bde81d94
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/isel-splat-vector-neg-i8.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -march=hexagon < %s | FileCheck %s
+
+define <4 x i8> @fred() #0 {
+; CHECK-LABEL: fred:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    {
+; CHECK-NEXT:     r0 = ##-16843010
+; CHECK-NEXT:     jumpr r31
+; CHECK-NEXT:    }
+  %v0 = insertelement <4 x i8> undef, i8 -2, i32 0
+  %v1 = shufflevector <4 x i8> %v0, <4 x i8> undef, <4 x i32> zeroinitializer
+  ret <4 x i8> %v1
+}
+
+attributes #0 = { nounwind readnone }


        


More information about the llvm-commits mailing list