Skip to content

Commit 06f9a4e

Browse files
author
git apple-llvm automerger
committed
Merge commit '82d8a9561137' from llvm.org/main into next
2 parents 15fe8b8 + 82d8a95 commit 06f9a4e

File tree

22 files changed

+487
-2
lines changed

22 files changed

+487
-2
lines changed

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/abs.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
; RUN: llc -O0 -mtriple=spirv-unknown-linux %s -o - | FileCheck %s
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
23

34
; CHECK: OpExtInstImport "GLSL.std.450"
45

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
; CHECK: OpExtInstImport "GLSL.std.450"
4+
5+
define noundef float @ceil_float(float noundef %a) {
6+
entry:
7+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Ceil %[[#]]
8+
%elt.ceil = call float @llvm.ceil.f32(float %a)
9+
ret float %elt.ceil
10+
}
11+
12+
define noundef half @ceil_half(half noundef %a) {
13+
entry:
14+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Ceil %[[#]]
15+
%elt.ceil = call half @llvm.ceil.f16(half %a)
16+
ret half %elt.ceil
17+
}
18+
19+
declare half @llvm.ceil.f16(half)
20+
declare float @llvm.ceil.f32(float)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @cos_float(float noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Cos %[[#]]
9+
%elt.cos = call float @llvm.cos.f32(float %a)
10+
ret float %elt.cos
11+
}
12+
13+
define noundef half @cos_half(half noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Cos %[[#]]
16+
%elt.cos = call half @llvm.cos.f16(half %a)
17+
ret half %elt.cos
18+
}
19+
20+
declare half @llvm.cos.f16(half)
21+
declare float @llvm.cos.f32(float)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @exp_float(float noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Exp %[[#]]
9+
%elt.exp = call float @llvm.exp.f32(float %a)
10+
ret float %elt.exp
11+
}
12+
13+
define noundef half @exp_half(half noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Exp %[[#]]
16+
%elt.exp = call half @llvm.exp.f16(half %a)
17+
ret half %elt.exp
18+
}
19+
20+
declare half @llvm.exp.f16(half)
21+
declare float @llvm.exp.f32(float)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @exp2_float(float noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Exp2 %[[#]]
9+
%elt.exp2 = call float @llvm.exp2.f32(float %a)
10+
ret float %elt.exp2
11+
}
12+
13+
define noundef half @exp2_half(half noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Exp2 %[[#]]
16+
%elt.exp2 = call half @llvm.exp2.f16(half %a)
17+
ret half %elt.exp2
18+
}
19+
20+
declare half @llvm.exp2.f16(half)
21+
declare float @llvm.exp2.f32(float)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @floor_float(float noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Floor %[[#]]
9+
%elt.floor = call float @llvm.floor.f32(float %a)
10+
ret float %elt.floor
11+
}
12+
13+
define noundef half @floor_half(half noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Floor %[[#]]
16+
%elt.floor = call half @llvm.floor.f16(half %a)
17+
ret half %elt.floor
18+
}
19+
20+
declare half @llvm.floor.f16(half)
21+
declare float @llvm.floor.f32(float)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef half @fmad_half(half noundef %a, half noundef %b, half noundef %c) #0 {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Fma %[[#]] %[[#]] %[[#]]
9+
%dx.fmad = call half @llvm.fmuladd.f16(half %a, half %b, half %c)
10+
ret half %dx.fmad
11+
}
12+
13+
define noundef float @fmad_float(float noundef %a, float noundef %b, float noundef %c) #0 {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Fma %[[#]] %[[#]] %[[#]]
16+
%dx.fmad = call float @llvm.fmuladd.f32(float %a, float %b, float %c)
17+
ret float %dx.fmad
18+
}
19+
20+
define noundef double @fmad_double(double noundef %a, double noundef %b, double noundef %c) {
21+
entry:
22+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Fma %[[#]] %[[#]] %[[#]]
23+
%dx.fmad = call double @llvm.fmuladd.f64(double %a, double %b, double %c)
24+
ret double %dx.fmad
25+
}
26+
27+
declare half @llvm.fmuladd.f16(half, half, half)
28+
declare float @llvm.fmuladd.f32(float, float, float)
29+
declare double @llvm.fmuladd.f64(double, double, double)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
; TODO: This need to be NMax: See https://github.com/llvm/llvm-project/issues/87072
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef half @test_fmax_half(half noundef %a, half noundef %b) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] FMax %[[#]] %[[#]]
9+
%0 = call half @llvm.maxnum.f16(half %a, half %b)
10+
ret half %0
11+
}
12+
13+
define noundef float @test_fmax_float(float noundef %a, float noundef %b) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] FMax %[[#]] %[[#]]
16+
%0 = call float @llvm.maxnum.f32(float %a, float %b)
17+
ret float %0
18+
}
19+
20+
define noundef double @test_fmax_double(double noundef %a, double noundef %b) {
21+
entry:
22+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] FMax %[[#]] %[[#]]
23+
%0 = call double @llvm.maxnum.f64(double %a, double %b)
24+
ret double %0
25+
}
26+
27+
declare half @llvm.maxnum.f16(half, half)
28+
declare float @llvm.maxnum.f32(float, float)
29+
declare double @llvm.maxnum.f64(double, double)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
; TODO: This need to be NMin: See https://github.com/llvm/llvm-project/issues/87072
4+
5+
; CHECK: OpExtInstImport "GLSL.std.450"
6+
; CHECK: OpMemoryModel Logical GLSL450
7+
8+
define noundef half @test_fmax_half(half noundef %a, half noundef %b) {
9+
entry:
10+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] FMin %[[#]] %[[#]]
11+
%0 = call half @llvm.minnum.f16(half %a, half %b)
12+
ret half %0
13+
}
14+
15+
define noundef float @test_fmax_float(float noundef %a, float noundef %b) {
16+
entry:
17+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] FMin %[[#]] %[[#]]
18+
%0 = call float @llvm.minnum.f32(float %a, float %b)
19+
ret float %0
20+
}
21+
22+
define noundef double @test_fmax_double(double noundef %a, double noundef %b) {
23+
entry:
24+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] FMin %[[#]] %[[#]]
25+
%0 = call double @llvm.minnum.f64(double %a, double %b)
26+
ret double %0
27+
}
28+
29+
declare half @llvm.minnum.f16(half, half)
30+
declare float @llvm.minnum.f32(float, float)
31+
declare double @llvm.minnum.f64(double, double)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @log_float(float noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Log %[[#]]
9+
%elt.log = call float @llvm.log.f32(float %a)
10+
ret float %elt.log
11+
}
12+
13+
define noundef half @log_half(half noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Log %[[#]]
16+
%elt.log = call half @llvm.log.f16(half %a)
17+
ret half %elt.log
18+
}
19+
20+
declare half @llvm.log.f16(half)
21+
declare float @llvm.log.f32(float)

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/log10.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
; RUN: llc -O0 -mtriple=spirv-unknown-linux %s -o - | FileCheck %s
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
23

34
; CHECK: %[[#extinst:]] = OpExtInstImport "GLSL.std.450"
45

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @log2_float(float noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Log2 %[[#]]
9+
%elt.log2 = call float @llvm.log2.f32(float %a)
10+
ret float %elt.log2
11+
}
12+
13+
define noundef half @log2_half(half noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Log2 %[[#]]
16+
%elt.log2 = call half @llvm.log2.f16(half %a)
17+
ret half %elt.log2
18+
}
19+
20+
declare half @llvm.log2.f16(half)
21+
declare float @llvm.log2.f32(float)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @pow_float(float noundef %a,float noundef %b) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Pow %[[#]]
9+
%elt.pow = call float @llvm.pow.f32(float %a,float %b)
10+
ret float %elt.pow
11+
}
12+
13+
define noundef half @pow_half(half noundef %a, half noundef %b) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Pow %[[#]]
16+
%elt.pow = call half @llvm.pow.f16(half %a, half %b)
17+
ret half %elt.pow
18+
}
19+
20+
declare half @llvm.pow.f16(half,half)
21+
declare float @llvm.pow.f32(float,float)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpMemoryModel Logical GLSL450
5+
6+
define noundef i32 @reversebits_i32(i32 noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpBitReverse %[[#]] %[[#]]
9+
%elt.bitreverse = call i32 @llvm.bitreverse.i32(i32 %a)
10+
ret i32 %elt.bitreverse
11+
}
12+
13+
define noundef i16 @reversebits_i16(i16 noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpBitReverse %[[#]] %[[#]]
16+
%elt.bitreverse = call i16 @llvm.bitreverse.i16(i16 %a)
17+
ret i16 %elt.bitreverse
18+
}
19+
20+
declare i16 @llvm.bitreverse.i16(i16)
21+
declare i32 @llvm.bitreverse.i32(i32)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @round_float(float noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] RoundEven %[[#]]
9+
%elt.roundeven = call float @llvm.roundeven.f32(float %a)
10+
ret float %elt.roundeven
11+
}
12+
13+
define noundef half @round_half(half noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] RoundEven %[[#]]
16+
%elt.roundeven = call half @llvm.roundeven.f16(half %a)
17+
ret half %elt.roundeven
18+
}
19+
20+
declare half @llvm.roundeven.f16(half)
21+
declare float @llvm.roundeven.f32(float)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef float @sin_float(float noundef %a) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Sin %[[#]]
9+
%elt.sin = call float @llvm.sin.f32(float %a)
10+
ret float %elt.sin
11+
}
12+
13+
define noundef half @sin_half(half noundef %a) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] Sin %[[#]]
16+
%elt.sin = call half @llvm.sin.f16(half %a)
17+
ret half %elt.sin
18+
}
19+
20+
declare half @llvm.sin.f16(half)
21+
declare float @llvm.sin.f32(float)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpExtInstImport "GLSL.std.450"
5+
6+
define noundef i16 @test_smax_i16(i16 noundef %a, i16 noundef %b) {
7+
entry:
8+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] SMax %[[#]] %[[#]]
9+
%0 = call i16 @llvm.smax.i16(i16 %a, i16 %b)
10+
ret i16 %0
11+
}
12+
13+
define noundef i32 @test_smax_i32(i32 noundef %a, i32 noundef %b) {
14+
entry:
15+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] SMax %[[#]] %[[#]]
16+
%0 = call i32 @llvm.smax.i32(i32 %a, i32 %b)
17+
ret i32 %0
18+
}
19+
20+
define noundef i64 @test_smax_i64(i64 noundef %a, i64 noundef %b) {
21+
entry:
22+
; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] SMax %[[#]] %[[#]]
23+
%0 = call i64 @llvm.smax.i64(i64 %a, i64 %b)
24+
ret i64 %0
25+
}
26+
27+
declare i16 @llvm.smax.i16(i16, i16)
28+
declare i32 @llvm.smax.i32(i32, i32)
29+
declare i64 @llvm.smax.i64(i64, i64)

0 commit comments

Comments
 (0)