Skip to content

Commit 8e707f8

Browse files
authored
[Flang][Lower] NFC: Update target-features/target-cpu tests (#80984)
Previously, some of these lowering tests inadvertently relied on a default triple not introducing any target features. This caused failures when compiling on a ppc64le-linux-unknown-gnu system. This patch updates these lowering tests to always explicitly set the target triple and check that the -target-cpu and -target-features compiler options are processed as expected.
1 parent 7d4733a commit 8e707f8

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
! REQUIRES: amdgpu-registered-target
2-
! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck %s --check-prefixes=ALL,NONE
3-
! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefixes=ALL,TRIPLE
4-
! RUN: %flang_fc1 -emit-fir -target-cpu gfx90a %s -o - | FileCheck %s --check-prefixes=ALL,CPU
5-
! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-cpu gfx90a %s -o - | FileCheck %s --check-prefixes=ALL,BOTH
2+
! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-cpu gfx90a %s -o - | FileCheck %s --check-prefixes=ALL,CPU
3+
! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-feature +sse %s -o - | FileCheck %s --check-prefixes=ALL,FEATURE
4+
! RUN: %flang_fc1 -emit-fir -triple amdgcn-amd-amdhsa -target-cpu gfx90a -target-feature +sse %s -o - | FileCheck %s --check-prefixes=ALL,BOTH
65

76
! ALL: module attributes {
87

9-
! NONE-NOT: fir.target_cpu
10-
! NONE-NOT: fir.target_features
11-
12-
! TRIPLE-SAME: fir.target_cpu = "generic-hsa"
13-
! TRIPLE-NOT: fir.target_features
14-
158
! CPU-SAME: fir.target_cpu = "gfx90a"
16-
! CPU-NOT: fir.target_features
9+
! CPU-SAME: fir.target_features = #llvm.target_features<[
10+
! CPU-SAME: "+gfx90a-insts"
11+
! CPU-SAME: ]>
12+
13+
! FEATURE-SAME: fir.target_features = #llvm.target_features<[
14+
! FEATURE-NOT: "+gfx90a-insts"
15+
! FEATURE-SAME: "+sse"
16+
! FEATURE-SAME: ]>
1717

1818
! BOTH-SAME: fir.target_cpu = "gfx90a"
1919
! BOTH-SAME: fir.target_features = #llvm.target_features<[
2020
! BOTH-SAME: "+gfx90a-insts"
21+
! BOTH-SAME: "+sse"
2122
! BOTH-SAME: ]>
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
! REQUIRES: x86-registered-target
2-
! RUN: %flang_fc1 -emit-fir -triple x86_64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefixes=ALL,NONE
32
! RUN: %flang_fc1 -emit-fir -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o - | FileCheck %s --check-prefixes=ALL,CPU
43
! RUN: %flang_fc1 -emit-fir -triple x86_64-unknown-linux-gnu -target-feature +sse %s -o - | FileCheck %s --check-prefixes=ALL,FEATURE
54
! RUN: %flang_fc1 -emit-fir -triple x86_64-unknown-linux-gnu -target-cpu x86-64 -target-feature +sse %s -o - | FileCheck %s --check-prefixes=ALL,BOTH
65

76
! ALL: module attributes {
87

9-
! NONE-NOT: fir.target_cpu
10-
! NONE-NOT: fir.target_features
8+
! CPU-SAME: fir.target_cpu = "x86-64"
119

12-
! CPU-SAME: fir.target_cpu = "x86-64"
13-
! CPU-NOT: fir.target_features
14-
15-
! FEATURE-NOT: fir.target_cpu
16-
! FEATURE-SAME: fir.target_features = #llvm.target_features<["+sse"]>
10+
! FEATURE-SAME: fir.target_features = #llvm.target_features<[
11+
! FEATURE-SAME: "+sse"
12+
! FEATURE-SAME: ]>
1713

1814
! BOTH-SAME: fir.target_cpu = "x86-64"
19-
! BOTH-SAME: fir.target_features = #llvm.target_features<["+sse"]>
15+
! BOTH-SAME: fir.target_features = #llvm.target_features<[
16+
! BOTH-SAME: "+sse"
17+
! BOTH-SAME: ]>

0 commit comments

Comments
 (0)