[Hexagon] Fix building 64-bit vector from constant values

The constants were aggregated in a reverse order.

llvm-svn: 322303
This commit is contained in:
Krzysztof Parzyszek 2018-01-11 18:30:41 +00:00
parent 4ef6cfff6a
commit 240df6faa4
2 changed files with 9 additions and 1 deletions

View File

@ -2652,7 +2652,7 @@ HexagonTargetLowering::buildVector64(ArrayRef<SDValue> Elem, const SDLoc &dl,
uint64_t Mask = (ElemTy == MVT::i8) ? 0xFFull
: (ElemTy == MVT::i16) ? 0xFFFFull : 0xFFFFFFFFull;
for (unsigned i = 0; i != Num; ++i)
Val = (Val << W) | (Consts[i]->getZExtValue() & Mask);
Val = (Val << W) | (Consts[Num-1-i]->getZExtValue() & Mask);
SDValue V0 = DAG.getConstant(Val, dl, MVT::i64);
return DAG.getBitcast(VecTy, V0);
}

View File

@ -0,0 +1,8 @@
; RUN: llc -march=hexagon < %s | FileCheck %s
; Check that the value produced is 0x0706050403020100.
; CHECK: r1:0 = CONST64(#506097522914230528)
define <8 x i8> @fred() {
ret <8 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>
}