diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -3268,6 +3268,9 @@ ExtraBitsSize = alignTo(ExtraBitsSize, 8); ExtraBits = Realigned.getRawData()[0] & (((uint64_t)-1) >> (64 - ExtraBitsSize)); + + if (BitWidth < 64) + Realigned = Realigned.zext(ExtraBitsSize); Realigned.lshrInPlace(ExtraBitsSize); } else ExtraBits = Realigned.getRawData()[BitWidth / 64]; diff --git a/llvm/test/CodeGen/AArch64/aarch64_be-global-const.ll b/llvm/test/CodeGen/AArch64/aarch64_be-global-const.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/aarch64_be-global-const.ll @@ -0,0 +1,6 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=aarch64_be < %s | FileCheck %s + +@G = global <4 x i1> +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; CHECK: {{.*}}