[clang] [llvm] [clang] Reland Add tanf16 builtin and support for tan constrained intrinsic (PR #94559)
Arthur Eubanks via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 12 19:32:55 PDT 2024
aeubanks wrote:
SLPVectorizer can introduce `llvm.tan.v2f32`. For example, running `opt -O3` on the following introduces `llvm.tan.v2f32`
```
target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv7-unknown-linux-android26"
; Function Attrs: null_pointer_is_valid
define void @foo() #0 {
bb:
%call = call float @pluto(float 1.000000e+00)
%call1 = call i1 @ham(float %call)
%call2 = call float @pluto(float 0.000000e+00)
%call3 = call i1 @ham(float %call2)
%select = select i1 %call3, float 0.000000e+00, float 1.000000e+00
%select4 = select i1 %call1, float 0.000000e+00, float 1.000000e+00
store float %select, ptr null, align 4
%call5 = call ptr null(ptr null, float %select4, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00)
ret void
}
define float @pluto(float %arg) {
bb:
%call = call float @llvm.tan.f32(float %arg)
ret float %call
}
define i1 @ham(float %arg) {
bb:
%fcmp = fcmp ole float %arg, 0.000000e+00
ret i1 %fcmp
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.tan.f32(float) #1
attributes #0 = { null_pointer_is_valid }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
```
https://github.com/llvm/llvm-project/pull/94559
More information about the cfe-commits
mailing list