forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LLVM/RISCV] Add +nofdiv target attribute to RISCV
- Loading branch information
1 parent
28ce07c
commit 01c5980
Showing
10 changed files
with
144 additions
and
1 deletion.
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
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
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,11 @@ | ||
// RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32if -mno-fdiv -x c -E -dM %s \ | ||
// RUN: -o - | FileCheck %s | ||
// RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64if -mno-fdiv -x c -E -dM %s \ | ||
// RUN: -o - | FileCheck %s | ||
// RUN: %clang -target riscv32-unknown-linux-gnu -march=rv32ifd -mno-fdiv -x c -E -dM %s \ | ||
// RUN: -o - | FileCheck %s | ||
// RUN: %clang -target riscv64-unknown-linux-gnu -march=rv64ifd -mno-fdiv -x c -E -dM %s \ | ||
// RUN: -o - | FileCheck %s | ||
|
||
// CHECK-NOT: __riscv_fdiv | ||
// CHECK-NOT: __riscv_fsqrt |
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
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,35 @@ | ||
; RUN: llc -mtriple=riscv32 -mattr=+f -mattr=+nofdiv -verify-machineinstrs < %s | FileCheck %s | ||
; RUN: llc -mtriple=riscv32 -mattr=+d -mattr=+nofdiv -verify-machineinstrs < %s | FileCheck %s | ||
; RUN: llc -mtriple=riscv64 -mattr=+f -mattr=+nofdiv -verify-machineinstrs < %s | FileCheck %s | ||
; RUN: llc -mtriple=riscv64 -mattr=+d -mattr=+nofdiv -verify-machineinstrs < %s | FileCheck %s | ||
|
||
define float @fdiv_s(float %a, float %b) { | ||
; CHECK-LABEL: fdiv_s: | ||
; CHECK: call __divsf3@plt | ||
%ret = fdiv float %a, %b | ||
ret float %ret | ||
} | ||
|
||
define double @fdiv_d(double %a, double %b) { | ||
; CHECK-LABEL: fdiv_d: | ||
; CHECK: call __divdf3@plt | ||
%ret = fdiv double %a, %b | ||
ret double %ret | ||
} | ||
|
||
define float @sqrt_s(float %a) { | ||
; CHECK-LABEL: sqrt_s: | ||
; CHECK: call sqrtf@plt | ||
%ret = call float @llvm.sqrt.f32(float %a) | ||
ret float %ret | ||
} | ||
|
||
define double @sqrt_d(double %a) { | ||
; CHECK-LABEL: sqrt_d: | ||
; CHECK: call sqrt@plt | ||
%ret = call double @llvm.sqrt.f64(double %a) | ||
ret double %ret | ||
} | ||
|
||
declare float @llvm.sqrt.f32(float %a) | ||
declare double @llvm.sqrt.f64(double %a) |