xref: /llvm-project/llvm/test/Bitcode/constant-splat.ll (revision cbb24e139d0753d755d17fbe6bfac48ab44d0721)
1; RUN: llvm-as -use-constant-int-for-fixed-length-splat \
2; RUN:         -use-constant-fp-for-fixed-length-splat \
3; RUN:         -use-constant-int-for-scalable-splat \
4; RUN:         -use-constant-fp-for-scalable-splat \
5; RUN:   < %s | llvm-dis -use-constant-int-for-fixed-length-splat \
6; RUN:                   -use-constant-fp-for-fixed-length-splat \
7; RUN:                   -use-constant-int-for-scalable-splat \
8; RUN:                   -use-constant-fp-for-scalable-splat \
9; RUN:   | FileCheck %s
10
11; CHECK: @constant.splat.i1 = constant <1 x i1> splat (i1 true)
12@constant.splat.i1 = constant <1 x i1> splat (i1 true)
13
14; CHECK: @constant.splat.i32 = constant <5 x i32> splat (i32 7)
15@constant.splat.i32 = constant <5 x i32> splat (i32 7)
16
17; CHECK: @constant.splat.i128 = constant <7 x i128> splat (i128 85070591730234615870450834276742070272)
18@constant.splat.i128 = constant <7 x i128> splat (i128 85070591730234615870450834276742070272)
19
20; CHECK: @constant.splat.f16 = constant <2 x half> splat (half 0xHBC00)
21@constant.splat.f16 = constant <2 x half> splat (half 0xHBC00)
22
23; CHECK: @constant.splat.f32 = constant <4 x float> splat (float -2.000000e+00)
24@constant.splat.f32 = constant <4 x float> splat (float -2.000000e+00)
25
26; CHECK: @constant.splat.f64 = constant <6 x double> splat (double -3.000000e+00)
27@constant.splat.f64 = constant <6 x double> splat (double -3.000000e+00)
28
29; CHECK: @constant.splat.128 = constant <8 x fp128> splat (fp128 0xL00000000000000018000000000000000)
30@constant.splat.128 = constant <8 x fp128> splat (fp128 0xL00000000000000018000000000000000)
31
32; CHECK: @constant.splat.bf16 = constant <1 x bfloat> splat (bfloat 0xRC0A0)
33@constant.splat.bf16 = constant <1 x bfloat> splat (bfloat 0xRC0A0)
34
35; CHECK: @constant.splat.x86_fp80 = constant <3 x x86_fp80> splat (x86_fp80 0xK4000C8F5C28F5C28F800)
36@constant.splat.x86_fp80 = constant <3 x x86_fp80> splat (x86_fp80 0xK4000C8F5C28F5C28F800)
37
38; CHECK: @constant.splat.ppc_fp128 = constant <7 x ppc_fp128> splat (ppc_fp128 0xM80000000000000000000000000000000)
39@constant.splat.ppc_fp128 = constant <7 x ppc_fp128> splat (ppc_fp128 0xM80000000000000000000000000000000)
40
41define void @add_fixed_lenth_vector_splat_i32(<4 x i32> %a) {
42; CHECK: %add = add <4 x i32> %a, splat (i32 137)
43  %add = add <4 x i32> %a, splat (i32 137)
44  ret void
45}
46
47define <4 x i32> @ret_fixed_lenth_vector_splat_i32() {
48; CHECK: ret <4 x i32> splat (i32 56)
49  ret <4 x i32> splat (i32 56)
50}
51
52define void @add_fixed_lenth_vector_splat_double(<vscale x 2 x double> %a) {
53; CHECK: %add = fadd <vscale x 2 x double> %a, splat (double 5.700000e+00)
54  %add = fadd <vscale x 2 x double> %a, splat (double 5.700000e+00)
55  ret void
56}
57
58define <vscale x 4 x i32> @ret_scalable_vector_splat_i32() {
59; CHECK: ret <vscale x 4 x i32> splat (i32 78)
60  ret <vscale x 4 x i32> splat (i32 78)
61}
62
63define <4 x i32> @canonical_constant_vector() {
64; CHECK: ret <4 x i32> splat (i32 7)
65  ret <4 x i32> <i32 7, i32 7, i32 7, i32 7>
66}
67
68define <4 x i32> @canonical_fixed_lnegth_vector_zero() {
69; CHECK: ret <4 x i32> zeroinitializer
70  ret <4 x i32> zeroinitializer
71}
72
73define <vscale x 4 x i32> @canonical_scalable_lnegth_vector_zero() {
74; CHECK: ret <vscale x 4 x i32> zeroinitializer
75  ret <vscale x 4 x i32> zeroinitializer
76}
77