forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 This is part 2 of 4 PRs. It sets the ground work for adding the intrinsics. Add SPIRV Lower for `acos`, `asin`, `atan`, `cosh`, `sinh`, and `tanh` llvm#70079 llvm#70080 llvm#70081 llvm#70083 llvm#70084 llvm#95966
- Loading branch information
Showing
14 changed files
with
387 additions
and
3 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
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
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,45 @@ | ||
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s | ||
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} | ||
|
||
; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450" | ||
; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32 | ||
; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16 | ||
; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4 | ||
; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4 | ||
|
||
define noundef float @acos_float(float noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Acos %[[#arg0]] | ||
%elt.acos = call float @llvm.acos.f32(float %a) | ||
ret float %elt.acos | ||
} | ||
|
||
define noundef half @acos_half(half noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Acos %[[#arg0]] | ||
%elt.acos = call half @llvm.acos.f16(half %a) | ||
ret half %elt.acos | ||
} | ||
|
||
define noundef <4 x float> @acos_float4(<4 x float> noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Acos %[[#arg0]] | ||
%elt.acos = call <4 x float> @llvm.acos.v4f32(<4 x float> %a) | ||
ret <4 x float> %elt.acos | ||
} | ||
|
||
define noundef <4 x half> @acos_half4(<4 x half> noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Acos %[[#arg0]] | ||
%elt.acos = call <4 x half> @llvm.acos.v4f16(<4 x half> %a) | ||
ret <4 x half> %elt.acos | ||
} | ||
|
||
declare half @llvm.acos.f16(half) | ||
declare float @llvm.acos.f32(float) | ||
declare <4 x half> @llvm.acos.v4f16(<4 x half>) | ||
declare <4 x float> @llvm.acos.v4f32(<4 x float>) |
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,45 @@ | ||
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s | ||
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} | ||
|
||
; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450" | ||
; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32 | ||
; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16 | ||
; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4 | ||
; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4 | ||
|
||
define noundef float @asin_float(float noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Asin %[[#arg0]] | ||
%elt.asin = call float @llvm.asin.f32(float %a) | ||
ret float %elt.asin | ||
} | ||
|
||
define noundef half @asin_half(half noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Asin %[[#arg0]] | ||
%elt.asin = call half @llvm.asin.f16(half %a) | ||
ret half %elt.asin | ||
} | ||
|
||
define noundef <4 x float> @asin_float4(<4 x float> noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Asin %[[#arg0]] | ||
%elt.asin = call <4 x float> @llvm.asin.v4f32(<4 x float> %a) | ||
ret <4 x float> %elt.asin | ||
} | ||
|
||
define noundef <4 x half> @asin_half4(<4 x half> noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Asin %[[#arg0]] | ||
%elt.asin = call <4 x half> @llvm.asin.v4f16(<4 x half> %a) | ||
ret <4 x half> %elt.asin | ||
} | ||
|
||
declare half @llvm.asin.f16(half) | ||
declare float @llvm.asin.f32(float) | ||
declare <4 x half> @llvm.asin.v4f16(<4 x half>) | ||
declare <4 x float> @llvm.asin.v4f32(<4 x float>) |
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,45 @@ | ||
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s | ||
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} | ||
|
||
; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450" | ||
; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32 | ||
; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16 | ||
; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4 | ||
; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4 | ||
|
||
define noundef float @atan_float(float noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Atan %[[#arg0]] | ||
%elt.atan = call float @llvm.atan.f32(float %a) | ||
ret float %elt.atan | ||
} | ||
|
||
define noundef half @atan_half(half noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Atan %[[#arg0]] | ||
%elt.atan = call half @llvm.atan.f16(half %a) | ||
ret half %elt.atan | ||
} | ||
|
||
define noundef <4 x float> @atan_float4(<4 x float> noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Atan %[[#arg0]] | ||
%elt.atan = call <4 x float> @llvm.atan.v4f32(<4 x float> %a) | ||
ret <4 x float> %elt.atan | ||
} | ||
|
||
define noundef <4 x half> @atan_half4(<4 x half> noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Atan %[[#arg0]] | ||
%elt.atan = call <4 x half> @llvm.atan.v4f16(<4 x half> %a) | ||
ret <4 x half> %elt.atan | ||
} | ||
|
||
declare half @llvm.atan.f16(half) | ||
declare float @llvm.atan.f32(float) | ||
declare <4 x half> @llvm.atan.v4f16(<4 x half>) | ||
declare <4 x float> @llvm.atan.v4f32(<4 x float>) |
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,45 @@ | ||
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s | ||
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} | ||
|
||
; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450" | ||
; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32 | ||
; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16 | ||
; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4 | ||
; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4 | ||
|
||
define noundef float @cosh_float(float noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Cosh %[[#arg0]] | ||
%elt.cosh = call float @llvm.cosh.f32(float %a) | ||
ret float %elt.cosh | ||
} | ||
|
||
define noundef half @cosh_half(half noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Cosh %[[#arg0]] | ||
%elt.cosh = call half @llvm.cosh.f16(half %a) | ||
ret half %elt.cosh | ||
} | ||
|
||
define noundef <4 x float> @cosh_float4(<4 x float> noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] Cosh %[[#arg0]] | ||
%elt.cosh = call <4 x float> @llvm.cosh.v4f32(<4 x float> %a) | ||
ret <4 x float> %elt.cosh | ||
} | ||
|
||
define noundef <4 x half> @cosh_half4(<4 x half> noundef %a) { | ||
entry: | ||
; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] | ||
; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] Cosh %[[#arg0]] | ||
%elt.cosh = call <4 x half> @llvm.cosh.v4f16(<4 x half> %a) | ||
ret <4 x half> %elt.cosh | ||
} | ||
|
||
declare half @llvm.cosh.f16(half) | ||
declare float @llvm.cosh.f32(float) | ||
declare <4 x half> @llvm.cosh.v4f16(<4 x half>) | ||
declare <4 x float> @llvm.cosh.v4f32(<4 x float>) |
Oops, something went wrong.