From fc3228aaf94960e26dba8947acf366f9107777ef Mon Sep 17 00:00:00 2001 From: David Truby Date: Mon, 27 Jan 2025 12:23:03 +0000 Subject: [PATCH] [flang][NFC] Restrict -funroll-loops tests to known working targets If -funroll-loops tests are not restricted to specific targets the tests may behave differently based on the host platform. This patch restricts the tests to aarch64 and x86_64, and removes the PowerPC XFAIL. --- flang/test/Integration/unroll-loops.f90 | 20 ++++++++++++------- flang/test/{ => Lower}/HLFIR/unroll-loops.fir | 16 +++++++++------ 2 files changed, 23 insertions(+), 13 deletions(-) rename flang/test/{ => Lower}/HLFIR/unroll-loops.fir (73%) diff --git a/flang/test/Integration/unroll-loops.f90 b/flang/test/Integration/unroll-loops.f90 index 4b4a394502881..2f812e2bac59d 100644 --- a/flang/test/Integration/unroll-loops.f90 +++ b/flang/test/Integration/unroll-loops.f90 @@ -1,11 +1,17 @@ -! RUN: %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -! RUN: %flang_fc1 -emit-llvm -O2 -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -! RUN: %flang_fc1 -emit-llvm -O1 -fno-unroll-loops -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -! RUN: %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL - ! FIXME: https://github.com/llvm/llvm-project/issues/123668 -! XFAIL: target=powerpc64{{.*}} - +! +! DEFINE: %{triple} = +! DEFINE: %{check-unroll} = %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -triple %{triple} -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL +! DEFINE: %{check-nounroll} = %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -triple %{triple} -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL +! +! REDEFINE: %{triple} = aarch64-unknown-linux-gnu +! RUN: %if aarch64-registered-target %{ %{check-unroll} %} +! RUN: %if aarch64-registered-target %{ %{check-nounroll} %} +! +! REDEFINE: %{triple} = x86_64-unknown-linux-gnu +! RUN: %if x86-registered-target %{ %{check-unroll} %} +! RUN: %if x86-registered-target %{ %{check-nounroll} %} +! ! CHECK-LABEL: @unroll ! CHECK-SAME: (ptr nocapture writeonly %[[ARG0:.*]]) subroutine unroll(a) diff --git a/flang/test/HLFIR/unroll-loops.fir b/flang/test/Lower/HLFIR/unroll-loops.fir similarity index 73% rename from flang/test/HLFIR/unroll-loops.fir rename to flang/test/Lower/HLFIR/unroll-loops.fir index 4494cfa570dd7..42a236721e4c1 100644 --- a/flang/test/HLFIR/unroll-loops.fir +++ b/flang/test/Lower/HLFIR/unroll-loops.fir @@ -1,10 +1,14 @@ -// RUN: %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -// RUN: %flang_fc1 -emit-llvm -O2 -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL -// RUN: %flang_fc1 -emit-llvm -O1 -fno-unroll-loops -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -// RUN: %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL +// DEFINE: %{triple} = +// DEFINE: %{check-unroll} = %flang_fc1 -emit-llvm -O1 -funroll-loops -mllvm -force-vector-width=2 -triple %{triple} -o- %s | FileCheck %s --check-prefixes=CHECK,UNROLL +// DEFINE: %{check-nounroll} = %flang_fc1 -emit-llvm -O1 -mllvm -force-vector-width=2 -triple %{triple} -o- %s | FileCheck %s --check-prefixes=CHECK,NO-UNROLL -// FIXME: https://github.com/llvm/llvm-project/issues/123668 -// XFAIL: target=powerpc64{{.*}} +// REDEFINE: %{triple} = aarch64-unknown-linux-gnu +// RUN: %if aarch64-registered-target %{ %{check-unroll} %} +// RUN: %if aarch64-registered-target %{ %{check-nounroll} %} + +// REDEFINE: %{triple} = x86_64-unknown-linux-gnu +// RUN: %if x86-registered-target %{ %{check-unroll} %} +// RUN: %if x86-registered-target %{ %{check-nounroll} %} // CHECK-LABEL: @unroll // CHECK-SAME: (ptr nocapture writeonly %[[ARG0:.*]])