[llvm] [PowerPC][SDAG] fix bitcast on ppc_f128 swapping the two halves (PR #208969)

Folkert de Vries via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 04:44:33 PDT 2026


================
@@ -0,0 +1,54 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=BE
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s --check-prefix=LE
+
+; Regression test for #44482.
+;
+; A ppc_fp128 is two doubles, with the high-order double stored at the
+; lower address. Reading that as an integer therefore puts the high-order
+; double in the high 64 bits on big-endian targets and in the low 64 bits
+; on little-endian targets.
+;
+; But APFloat::bitcastToAPInt is endianness-agnostic and always places the
+; high-order double in the low 64 bits. Hence the two doubles must be
+; flipped on big-endian targets.
+
+; 27.0 is represented in memory as [0x403b000000000000, 0x0000000000000000].
----------------
folkertdev wrote:

Sure, added one. You can see the LE and BE cases are each other's inverses here too.

https://github.com/llvm/llvm-project/pull/208969


More information about the llvm-commits mailing list