Skip to content

Commit

Permalink
Update lit tests with splat() for LLVM trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
aneshlya committed Nov 8, 2024
1 parent e862e8c commit 7573605
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
14 changes: 7 additions & 7 deletions tests/lit-tests/2738_one_init.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@

// INT8-LABEL: @foo___
// INT8-NEXT: allocas:
// INT8-NEXT: ret <4 x i8> <i8 2, i8 2, i8 2, i8 2>
// INT8-NEXT: ret <4 x i8> {{<i8 2, i8 2, i8 2, i8 2>|splat \(i8 2\)}}

// INT16-LABEL: @foo___
// INT16-NEXT: allocas:
// INT16-NEXT: ret <4 x i16> <i16 2, i16 2, i16 2, i16 2>
// INT16-NEXT: ret <4 x i16> {{<i16 2, i16 2, i16 2, i16 2>|splat \(i16 2\)}}

// INT-LABEL: @foo___
// INT-NEXT: allocas:
// INT-NEXT: ret <4 x i32> <i32 2, i32 2, i32 2, i32 2>
// INT-NEXT: ret <4 x i32> {{<i32 2, i32 2, i32 2, i32 2>|splat \(i32 2\)}}

// INT64-LABEL: @foo___
// INT64-NEXT: allocas:
// INT64-NEXT: ret <4 x i64> <i64 2, i64 2, i64 2, i64 2>
// INT64-NEXT: ret <4 x i64> {{<i64 2, i64 2, i64 2, i64 2>|splat \(i64 2\)}}

// FLOAT16-LABEL: @foo___
// FLOAT16-NEXT: allocas:
// FLOAT16-NEXT: ret <4 x half> <half 0xH4000, half 0xH4000, half 0xH4000, half 0xH4000>
// FLOAT16-NEXT: ret <4 x half> {{<half 0xH4000, half 0xH4000, half 0xH4000, half 0xH4000>|splat \(half 0xH4000\)}}

// FLOAT-LABEL: @foo___
// FLOAT-NEXT: allocas:
// FLOAT-NEXT: ret <4 x float> <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
// FLOAT-NEXT: ret <4 x float> {{<float 2\.000000e\+00, float 2\.000000e\+00, float 2\.000000e\+00, float 2\.000000e\+00>|splat \(float 2\.000000e\+00\)}}

// DOUBLE-LABEL: @foo___
// DOUBLE-NEXT: allocas:
// DOUBLE-NEXT: ret <4 x double> <double 2.000000e+00, double 2.000000e+00, double 2.000000e+00, double 2.000000e+00>
// DOUBLE-NEXT: ret <4 x double> {{<double 2\.000000e\+00, double 2\.000000e\+00, double 2\.000000e\+00, double 2\.000000e\+00>|splat \(double 2\.000000e\+00\)}}

// BOOL-NOT: Error: Initializer for global variable "y" must be a constant.
// INT8-NOT: Error: Initializer for global variable "y" must be a constant.
Expand Down
2 changes: 1 addition & 1 deletion tests/lit-tests/bool-casts-vectors.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ uniform uint64<4> to_uint64(uniform uint64<4> a, uniform uint64<4> b) { return a
// CHECK-LABEL: @to_bool___unb_3C_4_3E_unb_3C_4_3E_(
// CHECK-NEXT: allocas:
// CHECK-NEXT: [[XOR:%.*]] = xor <4 x i1> %a, %b
// CHECK-NEXT: [[NE:%.*]] = xor <4 x i1> [[XOR]], <i1 true, i1 true, i1 true, i1 true>
// CHECK-NEXT: [[NE:%.*]] = xor <4 x i1> [[XOR]], {{<i1 true, i1 true, i1 true, i1 true>|splat \(i1 true\)}}
// CHECK-NEXT: ret <4 x i1> [[NE]]

uniform bool<4> to_bool(uniform bool<4> a, uniform bool<4> b) { return a == b; }
3 changes: 1 addition & 2 deletions tests/lit-tests/bool-store-varying.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ void foo(uint8 a, uint8 b)
// varying vectors of bool matches masks bit count, so they have different
// element type (i1, i8, i16, i32, i64) for different archs (see
// src/llvmutil.cpp BoolVectoType).

// AVX2: define void @boo___vyb(<[[WIDTH]] x [[RTYPE:i[0-9]+]]> %a, <[[WIDTH]] x [[RTYPE]]> %__mask)
// AVX2-NEXT: allocas:
// AVX2-NEXT: [[TRUNC:%.*]] = trunc <[[WIDTH]] x [[RTYPE]]> %a to <[[WIDTH]] x i8>
// AVX2-NEXT: [[CAST:%.*]] = and <[[WIDTH]] x i8> [[TRUNC]], <i8 1, i8 1, i8 1, i8 1>
// AVX2-NEXT: [[CAST:%.*]] = and <[[WIDTH]] x i8> [[TRUNC]], {{(splat \(i8 1\)|<i8 1, i8 1, i8 1, i8 1>)}}
// AVX2-NEXT: store <[[WIDTH]] x i8> [[CAST]], {{.*}} @y
// AVX2-NEXT: ret void

Expand Down
8 changes: 4 additions & 4 deletions tests/lit-tests/float16_varying.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Tests float16 constant parsing in *e*f16 form.
//; CHECK: define <{{[0-9]*}} x half> @foo0___vyh(<{{[0-9]*}} x half>
//; CHECK: fadd <{{[0-9]*}} x half> %{{[a-zA-Z_][a-zA-Z0-9_]*}}, <half 0xH011D, half 0xH011D
//; CHECK: fadd <{{[0-9]*}} x half> %{{[a-zA-Z_][a-zA-Z0-9_]*}}, {{<half 0xH011D, half 0xH011D|splat \(half 0xH011D\)}}
varying float16 foo0(varying float16 arg0) {
arg0 = arg0 + 1.7e-5f16;
return arg0;
Expand Down Expand Up @@ -36,9 +36,9 @@ varying double foo4(varying float16 arg0) { return arg0; }
// Creates +0, -0, +inf and -inf.
//; CHECK: define void @foo5
//; CHECK: store <{{[0-9]*}} x half> zeroinitializer
//; CHECK: store <{{[0-9]*}} x half> <half 0xH8000
//; CHECK: store <{{[0-9]*}} x half> <half 0xH7C00
//; CHECK: store <{{[0-9]*}} x half> <half 0xHFC00
//; CHECK: store <{{[0-9]*}} x half> {{<half 0xH8000|splat \(half 0xH8000\)}}
//; CHECK: store <{{[0-9]*}} x half> {{<half 0xH7C00|splat \(half 0xH7C00\)}}
//; CHECK: store <{{[0-9]*}} x half> {{<half 0xHFC00|splat \(half 0xHFC00\)}}
void foo5() {
float16 pz = +0.f16;
float16 nz = -0.f16;
Expand Down
2 changes: 1 addition & 1 deletion tests/lit-tests/func_template_array_5.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %{ispc} %s --emit-llvm-text --target=avx2-i32x8 --nostdlib -o - | FileCheck %s

// CHECK-LABEL: define linkonce_odr void @func___Cuni1Cuni2Cuni3Cuni4Cuni5Cuni6
// CHECK: <8 x float> <float 4.000000e+00,
// CHECK: <8 x float> {{<float 4\.000000e\+00|splat \(float 4\.000000e\+00\)}}
// REQUIRES: X86_ENABLED && !MACOS_HOST

template<int N1, int N2, int N3, int N4, int N5, int N6>
Expand Down
8 changes: 4 additions & 4 deletions tests/lit-tests/func_template_nontype_1.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
// CHECK: call <{{[0-9]*}} x i32> @sum___Cuni3Cuni5___

// CHECK-LABEL: define linkonce_odr <{{[0-9]*}} x i32> @sum___vyiCuni2Cuni4___
// CHECK: ret {{.*}} i32 6
// CHECK: ret {{.*}} {{i32 6|splat \(i32 6\)}}
// CHECK-LABEL: define linkonce_odr <{{[0-9]*}} x i32> @sum___vyiCuni3Cuni5___
// CHECK: ret {{.*}} i32 8
// CHECK: ret {{.*}} {{i32 8|splat \(i32 8\)}}

// CHECK-LABEL: define linkonce_odr <{{[0-9]*}} x i32> @sum___Cuni2Cuni4___
// CHECK: ret {{.*}} i32 7
// CHECK: ret {{.*}} {{i32 7|splat \(i32 7\)}}
// CHECK-LABEL: define linkonce_odr <{{[0-9]*}} x i32> @sum___Cuni3Cuni5___
// CHECK: ret {{.*}} i32 9
// CHECK: ret {{.*}} {{i32 9|splat \(i32 9\)}}

template<typename T, int x, int y>
noinline T sum() {
Expand Down
2 changes: 1 addition & 1 deletion tests/lit-tests/func_template_nontype_5.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// CHECK: call <{{[0-9]*}} x i32> @enum_foo___vyiCunenum_5B_Foo_5D_2___uni

// CHECK-LABEL: define linkonce_odr <{{[0-9]*}} x i32> @enum_foo___vyiCunenum_5B_Foo_5D_2___uni
// CHECK: ret {{.*}} i32 2
// CHECK: ret {{.*}} {{i32 2|splat \(i32 2\)}}

enum Foo {
ZERO,
Expand Down
2 changes: 1 addition & 1 deletion tests/lit-tests/ispc-opt.ll
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ define <4 x i16> @__avg_down_uint16(<4 x i16> %0, <4 x i16> %1) {
; CHECK-PEEPHOLE-NEXT: %a_ext = zext <4 x i16> %a to <4 x i32>
; CHECK-PEEPHOLE-NEXT: %b_ext = zext <4 x i16> %b to <4 x i32>
; CHECK-PEEPHOLE-NEXT: %add = add <4 x i32> %a_ext, %b_ext
; CHECK-PEEPHOLE-NEXT: %div = udiv <4 x i32> %add, <i32 2, i32 2, i32 2, i32 2>
; CHECK-PEEPHOLE-NEXT: %div = udiv <4 x i32> %add, {{<i32 2, i32 2, i32 2, i32 2>|splat \(i32 2\)}}
; CHECK-PEEPHOLE-NEXT: %__avg_down_uint16 = call <4 x i16> @__avg_down_uint16(<4 x i16> %a, <4 x i16> %b)
; CHECK-PEEPHOLE-NEXT: ret <4 x i16> %__avg_down_uint16
; CHECK-PEEPHOLE-NEXT: }
Expand Down

0 comments on commit 7573605

Please sign in to comment.