[flang-commits] [flang] [flang] Run real 10 test on x86 only (NFC) (PR #73911)

via flang-commits flang-commits at lists.llvm.org
Tue Dec 5 05:03:31 PST 2023


https://github.com/madanial0 updated https://github.com/llvm/llvm-project/pull/73911

>From b793beb97047610aa4781ef6e1019f50a88cde2d Mon Sep 17 00:00:00 2001
From: Mark Danial <madanial at dixon.rtp.raleigh.ibm.com>
Date: Thu, 30 Nov 2023 02:23:48 -0500
Subject: [PATCH 1/6] [Flang] remove real 10 test for ppc (NFC)

---
 flang/unittests/Evaluate/real.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/flang/unittests/Evaluate/real.cpp b/flang/unittests/Evaluate/real.cpp
index 9701082898388..dca1ebfa2db50 100644
--- a/flang/unittests/Evaluate/real.cpp
+++ b/flang/unittests/Evaluate/real.cpp
@@ -14,7 +14,9 @@ using Real2 = Scalar<Type<TypeCategory::Real, 2>>;
 using Real3 = Scalar<Type<TypeCategory::Real, 3>>;
 using Real4 = Scalar<Type<TypeCategory::Real, 4>>;
 using Real8 = Scalar<Type<TypeCategory::Real, 8>>;
+#ifndef __PPC__
 using Real10 = Scalar<Type<TypeCategory::Real, 10>>;
+#endif
 using Real16 = Scalar<Type<TypeCategory::Real, 16>>;
 using Integer4 = Scalar<Type<TypeCategory::Integer, 4>>;
 using Integer8 = Scalar<Type<TypeCategory::Integer, 8>>;
@@ -538,7 +540,9 @@ void roundTest(int rm, Rounding rounding, std::uint32_t opds) {
   basicTests<Real3>(rm, rounding);
   basicTests<Real4>(rm, rounding);
   basicTests<Real8>(rm, rounding);
+#ifndef __PPC__
   basicTests<Real10>(rm, rounding);
+#endif
   basicTests<Real16>(rm, rounding);
   ScopedHostFloatingPointEnvironment::SetRounding(rounding);
   subsetTests<std::uint32_t, float, Real4>(rm, rounding, opds);

>From 7cee7b03cff1a68026cdf1dfead173b0318ac28c Mon Sep 17 00:00:00 2001
From: Mark Danial <madanial at dixon.rtp.raleigh.ibm.com>
Date: Mon, 4 Dec 2023 17:31:09 -0500
Subject: [PATCH 2/6] [flang] Run real 10 test on x86 only (NFC)

---
 flang/unittests/Evaluate/real.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/flang/unittests/Evaluate/real.cpp b/flang/unittests/Evaluate/real.cpp
index dca1ebfa2db50..ccbaf81f054cb 100644
--- a/flang/unittests/Evaluate/real.cpp
+++ b/flang/unittests/Evaluate/real.cpp
@@ -14,7 +14,7 @@ using Real2 = Scalar<Type<TypeCategory::Real, 2>>;
 using Real3 = Scalar<Type<TypeCategory::Real, 3>>;
 using Real4 = Scalar<Type<TypeCategory::Real, 4>>;
 using Real8 = Scalar<Type<TypeCategory::Real, 8>>;
-#ifndef __PPC__
+#ifdef __x86_64__
 using Real10 = Scalar<Type<TypeCategory::Real, 10>>;
 #endif
 using Real16 = Scalar<Type<TypeCategory::Real, 16>>;
@@ -540,7 +540,7 @@ void roundTest(int rm, Rounding rounding, std::uint32_t opds) {
   basicTests<Real3>(rm, rounding);
   basicTests<Real4>(rm, rounding);
   basicTests<Real8>(rm, rounding);
-#ifndef __PPC__
+#ifdef __x86_64__
   basicTests<Real10>(rm, rounding);
 #endif
   basicTests<Real16>(rm, rounding);

>From 943a6cbd4d7c6ada6341d68401e46108e6c0b83b Mon Sep 17 00:00:00 2001
From: Mark Danial <madanial at dixon.rtp.raleigh.ibm.com>
Date: Mon, 4 Dec 2023 18:21:32 -0500
Subject: [PATCH 3/6] Only test real 10 assignment on x86_64

---
 flang/test/Lower/assignment.f90 | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/flang/test/Lower/assignment.f90 b/flang/test/Lower/assignment.f90
index 5eb55f864add7..6289bf82cc11d 100644
--- a/flang/test/Lower/assignment.f90
+++ b/flang/test/Lower/assignment.f90
@@ -1,4 +1,4 @@
-! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s
+! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s --check-prefixes=CHECK%if target=x86_64{{.*}} %{,CHECK-X86-64%}
 
 subroutine sub1(a)
   integer :: a
@@ -264,19 +264,23 @@ subroutine real_constant()
   real(2) :: a
   real(4) :: b
   real(8) :: c
+#ifdef __x86_64__
   real(10) :: d
+#endif
   real(16) :: e
   a = 2.0_2
   b = 4.0_4
   c = 8.0_8
+#ifdef __x86_64__
   d = 10.0_10
+#endif
   e = 16.0_16
 end
 
 ! CHECK: %[[A:.*]] = fir.alloca f16
 ! CHECK: %[[B:.*]] = fir.alloca f32
 ! CHECK: %[[C:.*]] = fir.alloca f64
-! CHECK: %[[D:.*]] = fir.alloca f80
+! CHECK-X86-64: %[[D:.*]] = fir.alloca f80
 ! CHECK: %[[E:.*]] = fir.alloca f128
 ! CHECK: %[[C2:.*]] = arith.constant 2.000000e+00 : f16
 ! CHECK: fir.store %[[C2]] to %[[A]] : !fir.ref<f16>
@@ -284,8 +288,8 @@ subroutine real_constant()
 ! CHECK: fir.store %[[C4]] to %[[B]] : !fir.ref<f32>
 ! CHECK: %[[C8:.*]] = arith.constant 8.000000e+00 : f64
 ! CHECK: fir.store %[[C8]] to %[[C]] : !fir.ref<f64>
-! CHECK: %[[C10:.*]] = arith.constant 1.000000e+01 : f80
-! CHECK: fir.store %[[C10]] to %[[D]] : !fir.ref<f80>
+! CHECK-X86-64: %[[C10:.*]] = arith.constant 1.000000e+01 : f80
+! CHECK-X86-64: fir.store %[[C10]] to %[[D]] : !fir.ref<f80>
 ! CHECK: %[[C16:.*]] = arith.constant 1.600000e+01 : f128
 ! CHECK: fir.store %[[C16]] to %[[E]] : !fir.ref<f128>
 

>From 93354968ab55568e792fa551fd4ce4d06c506584 Mon Sep 17 00:00:00 2001
From: Mark Danial <madanial at dixon.rtp.raleigh.ibm.com>
Date: Mon, 4 Dec 2023 18:47:03 -0500
Subject: [PATCH 4/6] Revert "Only test real 10 assignment on x86_64"

This reverts commit 943a6cbd4d7c6ada6341d68401e46108e6c0b83b.
---
 flang/test/Lower/assignment.f90 | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/flang/test/Lower/assignment.f90 b/flang/test/Lower/assignment.f90
index 6289bf82cc11d..5eb55f864add7 100644
--- a/flang/test/Lower/assignment.f90
+++ b/flang/test/Lower/assignment.f90
@@ -1,4 +1,4 @@
-! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s --check-prefixes=CHECK%if target=x86_64{{.*}} %{,CHECK-X86-64%}
+! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s
 
 subroutine sub1(a)
   integer :: a
@@ -264,23 +264,19 @@ subroutine real_constant()
   real(2) :: a
   real(4) :: b
   real(8) :: c
-#ifdef __x86_64__
   real(10) :: d
-#endif
   real(16) :: e
   a = 2.0_2
   b = 4.0_4
   c = 8.0_8
-#ifdef __x86_64__
   d = 10.0_10
-#endif
   e = 16.0_16
 end
 
 ! CHECK: %[[A:.*]] = fir.alloca f16
 ! CHECK: %[[B:.*]] = fir.alloca f32
 ! CHECK: %[[C:.*]] = fir.alloca f64
-! CHECK-X86-64: %[[D:.*]] = fir.alloca f80
+! CHECK: %[[D:.*]] = fir.alloca f80
 ! CHECK: %[[E:.*]] = fir.alloca f128
 ! CHECK: %[[C2:.*]] = arith.constant 2.000000e+00 : f16
 ! CHECK: fir.store %[[C2]] to %[[A]] : !fir.ref<f16>
@@ -288,8 +284,8 @@ subroutine real_constant()
 ! CHECK: fir.store %[[C4]] to %[[B]] : !fir.ref<f32>
 ! CHECK: %[[C8:.*]] = arith.constant 8.000000e+00 : f64
 ! CHECK: fir.store %[[C8]] to %[[C]] : !fir.ref<f64>
-! CHECK-X86-64: %[[C10:.*]] = arith.constant 1.000000e+01 : f80
-! CHECK-X86-64: fir.store %[[C10]] to %[[D]] : !fir.ref<f80>
+! CHECK: %[[C10:.*]] = arith.constant 1.000000e+01 : f80
+! CHECK: fir.store %[[C10]] to %[[D]] : !fir.ref<f80>
 ! CHECK: %[[C16:.*]] = arith.constant 1.600000e+01 : f128
 ! CHECK: fir.store %[[C16]] to %[[E]] : !fir.ref<f128>
 

>From bda89003da7a109fc941f89c4be4b2415ada195d Mon Sep 17 00:00:00 2001
From: Mark Danial <madanial at dixon.rtp.raleigh.ibm.com>
Date: Tue, 5 Dec 2023 07:37:16 -0500
Subject: [PATCH 5/6] change test driver from bbc to flang-new to process
 macros

---
 flang/test/Lower/assignment.f90 | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/flang/test/Lower/assignment.f90 b/flang/test/Lower/assignment.f90
index 5eb55f864add7..ac6f3fbf82379 100644
--- a/flang/test/Lower/assignment.f90
+++ b/flang/test/Lower/assignment.f90
@@ -1,4 +1,4 @@
-! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s
+! RUN: %flang_fc1 %s -o "-" -emit-fir -flang-deprecated-no-hlfir | FileCheck %s --check-prefixes=CHECK%if target=x86_64{{.*}} %{,CHECK-X86-64%}
 
 subroutine sub1(a)
   integer :: a
@@ -264,19 +264,23 @@ subroutine real_constant()
   real(2) :: a
   real(4) :: b
   real(8) :: c
+#ifdef __x86_64__
   real(10) :: d
+#endif
   real(16) :: e
   a = 2.0_2
   b = 4.0_4
   c = 8.0_8
+#ifdef __x86_64__
   d = 10.0_10
+#endif
   e = 16.0_16
 end
 
 ! CHECK: %[[A:.*]] = fir.alloca f16
 ! CHECK: %[[B:.*]] = fir.alloca f32
 ! CHECK: %[[C:.*]] = fir.alloca f64
-! CHECK: %[[D:.*]] = fir.alloca f80
+! CHECK-X86-64: %[[D:.*]] = fir.alloca f80
 ! CHECK: %[[E:.*]] = fir.alloca f128
 ! CHECK: %[[C2:.*]] = arith.constant 2.000000e+00 : f16
 ! CHECK: fir.store %[[C2]] to %[[A]] : !fir.ref<f16>
@@ -284,8 +288,8 @@ subroutine real_constant()
 ! CHECK: fir.store %[[C4]] to %[[B]] : !fir.ref<f32>
 ! CHECK: %[[C8:.*]] = arith.constant 8.000000e+00 : f64
 ! CHECK: fir.store %[[C8]] to %[[C]] : !fir.ref<f64>
-! CHECK: %[[C10:.*]] = arith.constant 1.000000e+01 : f80
-! CHECK: fir.store %[[C10]] to %[[D]] : !fir.ref<f80>
+! CHECK-X86-64: %[[C10:.*]] = arith.constant 1.000000e+01 : f80
+! CHECK-X86-64: fir.store %[[C10]] to %[[D]] : !fir.ref<f80>
 ! CHECK: %[[C16:.*]] = arith.constant 1.600000e+01 : f128
 ! CHECK: fir.store %[[C16]] to %[[E]] : !fir.ref<f128>
 

>From 0080779ab523703c728ede363f99fc484ffa589c Mon Sep 17 00:00:00 2001
From: Mark Danial <madanial at dixon.rtp.raleigh.ibm.com>
Date: Tue, 5 Dec 2023 08:03:06 -0500
Subject: [PATCH 6/6] change #ifdef to #if for the testcase

---
 flang/test/Lower/assignment.f90 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/flang/test/Lower/assignment.f90 b/flang/test/Lower/assignment.f90
index ac6f3fbf82379..37f86876460dd 100644
--- a/flang/test/Lower/assignment.f90
+++ b/flang/test/Lower/assignment.f90
@@ -264,14 +264,14 @@ subroutine real_constant()
   real(2) :: a
   real(4) :: b
   real(8) :: c
-#ifdef __x86_64__
+#if __x86_64__
   real(10) :: d
 #endif
   real(16) :: e
   a = 2.0_2
   b = 4.0_4
   c = 8.0_8
-#ifdef __x86_64__
+#if __x86_64__
   d = 10.0_10
 #endif
   e = 16.0_16



More information about the flang-commits mailing list