[clang] [clang][AArch64] Enable fp128 for aarch64 linux target (PR #85070)

Matthew Devereau via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 05:44:01 PDT 2024


https://github.com/MDevereau created https://github.com/llvm/llvm-project/pull/85070

None

>From 51bd7b1ff944032e9aba5da1fd1a61bec0dafddd Mon Sep 17 00:00:00 2001
From: Matt Devereau <matthew.devereau at arm.com>
Date: Wed, 13 Mar 2024 12:15:33 +0000
Subject: [PATCH] [clang][AArch64] Enable fp128 for aarch64 linux target

---
 clang/lib/Basic/Targets/OSTargets.h           |  1 +
 .../test/CodeGenCXX/float128-declarations.cpp | 24 +++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index 4366c1149e4053..ba92604b9bcb9a 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -359,6 +359,7 @@ class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public OSTargetInfo<Target> {
       break;
     case llvm::Triple::x86:
     case llvm::Triple::x86_64:
+    case llvm::Triple::aarch64:
       this->HasFloat128 = true;
       break;
     }
diff --git a/clang/test/CodeGenCXX/float128-declarations.cpp b/clang/test/CodeGenCXX/float128-declarations.cpp
index 84b8f7f33036b5..79c99ba2796126 100644
--- a/clang/test/CodeGenCXX/float128-declarations.cpp
+++ b/clang/test/CodeGenCXX/float128-declarations.cpp
@@ -26,6 +26,8 @@
 // RUN:   %s -o - | FileCheck %s -check-prefix=CHECK-X86
 // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-haiku -std=c++11 \
 // RUN:   %s -o - | FileCheck %s -check-prefix=CHECK-X86
+// RUN: %clang_cc1 -emit-llvm -triple aarch64-linux-gnu -std=c++11 \
+// RUN:   %s -o - | FileCheck %s -check-prefix=CHECK-AARCH64-DAG
 //
 /*  Various contexts where type __float128 can appear. The different check
     prefixes are due to different mangling on X86.  */
@@ -131,3 +133,25 @@ int main(void) {
 // CHECK-X86-DAG: [[F4L:%[a-z0-9]+]] = load fp128, ptr %f4l
 // CHECK-X86-DAG: [[INC:%[a-z0-9]+]] = fadd fp128 [[F4L]], 0xL00000000000000003FFF000000000000
 // CHECK-X86-DAG: store fp128 [[INC]], ptr %f4l
+
+// CHECK-AARCH64-DAG: @f1f ={{.*}} global fp128 0xL00000000000000000000000000000000
+// CHECK-AARCH64-DAG: @f2f ={{.*}} global fp128 0xL33333333333333334004033333333333
+// CHECK-AARCH64-DAG: @arr1f ={{.*}} global [10 x fp128]
+// CHECK-AARCH64-DAG: @arr2f ={{.*}} global [3 x fp128] [fp128 0xL3333333333333333BFFF333333333333, fp128 0xL0000000000000000C000800000000000, fp128 0xL0000000000000000C025176592E00000]
+// CHECK-AARCH64-DAG: @__const.main.s1 = private unnamed_addr constant %struct.S1 { fp128 0xL00000000000000004006080000000000 }
+// CHECK-AARCH64-DAG: @_ZN12_GLOBAL__N_13f1nE = internal global fp128 0xL00000000000000000000000000000000
+// CHECK-AARCH64-DAG: @_ZN12_GLOBAL__N_13f2nE = internal global fp128 0xL00000000000000004004080000000000
+// CHECK-AARCH64-DAG: @_ZN12_GLOBAL__N_15arr1nE = internal global [10 x fp128]
+// CHECK-AARCH64-DAG: @_ZN12_GLOBAL__N_15arr2nE = internal global [3 x fp128] [fp128 0xL33333333333333333FFF333333333333, fp128 0xL00000000000000004000800000000000, fp128 0xL00000000000000004025176592E00000]
+// CHECK-AARCH64-DAG: store fp128 0xLF0AFD0EBFF292DCE42E0B38CDD83F26F, ptr %f1l, align 16
+// CHECK-AARCH64-DAG: store fp128 0xL00000000000000008000000000000000, ptr %f2l, align 16
+// CHECK-AARCH64-DAG: store fp128 0xLFFFFFFFFFFFFFFFF7FFEFFFFFFFFFFFF, ptr %f3l, align 16
+// CHECK-AARCH64-DAG: store fp128 0xL0000000000000000BFFF000000000000, ptr %f5l, align 16
+// CHECK-AARCH64-DAG: [[F4L:%[a-z0-9]+]] = load fp128, ptr %f4l
+// CHECK-AARCH64-DAG: [[INC:%[a-z0-9]+]] = fadd fp128 [[F4L]], 0xL00000000000000003FFF000000000000
+// CHECK-AARCH64-DAG: store fp128 [[INC]], ptr %f4l
+// CHECK-AARCH64-DAG: define internal noundef fp128 @_ZN12_GLOBAL__N_16func1nERKg(ptr
+// CHECK-AARCH64-DAG: declare noundef fp128 @_Z6func1fg(fp128 noundef)
+// CHECK-AARCH64-DAG: define linkonce_odr noundef fp128 @_ZN2C16func2cEg(fp128 noundef %arg)
+// CHECK-AARCH64-DAG: define linkonce_odr noundef fp128 @_Z6func1tIgET_S0_(fp128 noundef %arg)
+// CHECK-AARCH64-DAG: define linkonce_odr void @_ZN2C1C2Eg(ptr {{[^,]*}} %this, fp128 noundef %arg)



More information about the cfe-commits mailing list