================
@@ -51,10 +58,13 @@ mlir::Attribute 
getBitIntStorageAttr(mlir::ConversionPatternRewriter &rewriter,
   // If we have to do split storage, we are an array of bytes.  Split this up
   // into the array that matches convertTypeForMemory.
   unsigned numBytes = storageBits / 8;
+  bool bigEndian = isBigEndian(dataLayout);
   llvm::SmallVector<mlir::APInt> bytes;
   bytes.reserve(numBytes);
-  for (unsigned i = 0; i != numBytes; ++i)
-    bytes.emplace_back(8, val.extractBitsAsZExtValue(8, i * 8));
+  for (unsigned i = 0; i != numBytes; ++i) {
+    unsigned byteIndex = bigEndian ? numBytes - 1 - i : i;
----------------
xakep8 wrote:

Hey, This looks good, thank you for the patch🫡

https://github.com/llvm/llvm-project/pull/225829
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to