Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Flang][RISCV] Emit target features for RISC-V
Fix the issue of .o file generated by `Flang` with `Flags` info is 0x0 under RISC-V. Reviewed By: awarzynski, kiranchandramohan Differential Revision: https://reviews.llvm.org/D145883
- Loading branch information
Shao-Ce SUN
committed
Mar 15, 2023
1 parent
e6d670d
commit 36278b7
Showing
4 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
! Test -emit-obj (RISC-V 64) | ||
|
||
! REQUIRES: riscv-registered-target | ||
|
||
! RUN: rm -f %t.o | ||
! RUN: %flang_fc1 -triple riscv64-unknown-linux-gnu \ | ||
! RUN: -target-feature +d -target-feature +c -emit-obj %s -o %t.o | ||
! RUN: llvm-readelf -h %t.o | FileCheck %s | ||
|
||
! RUN: rm -f %t.o | ||
! RUN: %flang --target=riscv64-unknown-linux-gnu -c %s -o %t.o | ||
! RUN: llvm-readelf -h %t.o | FileCheck %s | ||
|
||
! If Flang failed to emit target-feature info, then Flags will be 0x0. | ||
! 0x5 means set EF_RISCV_RVC (0x1) and EF_RISCV_FLOAT_ABI_DOUBLE (0x4) | ||
! CHECK: Flags: 0x5, RVC, double-float ABI | ||
end program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
! REQUIRES: aarch64-registered-target | ||
|
||
! Test that invalid cpu and features are ignored. | ||
|
||
! RUN: %flang_fc1 -triple aarch64-linux-gnu -target-cpu supercpu \ | ||
! RUN: -o /dev/null -S %s 2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-CPU | ||
|
||
! RUN: %flang_fc1 -triple aarch64-linux-gnu -target-feature +superspeed \ | ||
! RUN: -o /dev/null -S %s 2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-FEATURE | ||
|
||
|
||
! CHECK-INVALID-CPU: 'supercpu' is not a recognized processor for this target (ignoring processor) | ||
! CHECK-INVALID-FEATURE: '+superspeed' is not a recognized feature for this target (ignoring feature) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters