[clang] Fix PowerPC test failure from [AsmWriter] Change the output syntax of floating-point literals. (PR #196407)

Joshua Cranmer via cfe-commits cfe-commits at lists.llvm.org
Thu May 7 12:53:23 PDT 2026


https://github.com/jcranmer-intel created https://github.com/llvm/llvm-project/pull/196407

The root cause of the failure is that the output syntax only outputs the +/-snan syntax for ppc_fp128 if the trailing double is 0. The clang test here is triggering -LDBL_SNAN, which is actually an fneg(snan constant), and the fneg causes the signs of both doubles in the ppc_fp128 to flip. As a result, only the ppc_fp128 form is output in the hexadecimal format rather than the -snan format, necessitating a change to the test output.

>From 21ccc35227189deb702443a8016a43e4e8857426 Mon Sep 17 00:00:00 2001
From: Joshua Cranmer <joshua.cranmer at intel.com>
Date: Thu, 7 May 2026 12:49:25 -0700
Subject: [PATCH] Fix PowerPC test failure from [AsmWriter] Change the output
 syntax of floating-point literals.

The root cause of the failure is that the output syntax only outputs the
+/-snan syntax for ppc_fp128 if the trailing double is 0. The clang test
here is triggering -LDBL_SNAN, which is actually an fneg(snan constant),
and the fneg causes the signs of both doubles in the ppc_fp128 to flip.
As a result, only the ppc_fp128 form is output in the hexadecimal format
rather than the -snan format, necessitating a change to the test output.
---
 clang/test/C/C2y/n3364.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/C/C2y/n3364.c b/clang/test/C/C2y/n3364.c
index 11c2999cb9be6..1662d637da071 100644
--- a/clang/test/C/C2y/n3364.c
+++ b/clang/test/C/C2y/n3364.c
@@ -39,4 +39,4 @@ long double ld2 = +LDBL_SNAN;
 long double ld3 = -LDBL_SNAN;
 // CHECK: @ld1 = {{.*}}global {{double|x86_fp80|fp128|ppc_fp128}} +snan(
 // CHECK: @ld2 = {{.*}}global {{double|x86_fp80|fp128|ppc_fp128}} +snan(
-// CHECK: @ld3 = {{.*}}global {{double|x86_fp80|fp128|ppc_fp128}} -snan(
+// CHECK: @ld3 = {{.*}}global {{double|x86_fp80|fp128|ppc_fp128}} {{-snan\(|f0x8000000000000000FFF4000000000000}}



More information about the cfe-commits mailing list