Home | History | Annotate | Download | only in SystemZ
      1 ; Test replications of a scalar register value, represented as splats.
      2 ;
      3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
      4 
      5 ; Test v16i8 splat of the first element.
      6 define <16 x i8> @f1(i8 %scalar) {
      7 ; CHECK-LABEL: f1:
      8 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
      9 ; CHECK: vrepb %v24, [[REG]], 7
     10 ; CHECK: br %r14
     11   %val = insertelement <16 x i8> undef, i8 %scalar, i32 0
     12   %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
     13                        <16 x i32> zeroinitializer
     14   ret <16 x i8> %ret
     15 }
     16 
     17 ; Test v16i8 splat of the last element.
     18 define <16 x i8> @f2(i8 %scalar) {
     19 ; CHECK-LABEL: f2:
     20 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
     21 ; CHECK: vrepb %v24, [[REG]], 7
     22 ; CHECK: br %r14
     23   %val = insertelement <16 x i8> undef, i8 %scalar, i32 15
     24   %ret = shufflevector <16 x i8> %val, <16 x i8> undef,
     25                        <16 x i32> <i32 15, i32 15, i32 15, i32 15,
     26                                    i32 15, i32 15, i32 15, i32 15,
     27                                    i32 15, i32 15, i32 15, i32 15,
     28                                    i32 15, i32 15, i32 15, i32 15>
     29   ret <16 x i8> %ret
     30 }
     31 
     32 ; Test v16i8 splat of an arbitrary element, using the second operand of
     33 ; the shufflevector.
     34 define <16 x i8> @f3(i8 %scalar) {
     35 ; CHECK-LABEL: f3:
     36 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
     37 ; CHECK: vrepb %v24, [[REG]], 7
     38 ; CHECK: br %r14
     39   %val = insertelement <16 x i8> undef, i8 %scalar, i32 4
     40   %ret = shufflevector <16 x i8> undef, <16 x i8> %val,
     41                        <16 x i32> <i32 20, i32 20, i32 20, i32 20,
     42                                    i32 20, i32 20, i32 20, i32 20,
     43                                    i32 20, i32 20, i32 20, i32 20,
     44                                    i32 20, i32 20, i32 20, i32 20>
     45   ret <16 x i8> %ret
     46 }
     47 
     48 ; Test v8i16 splat of the first element.
     49 define <8 x i16> @f4(i16 %scalar) {
     50 ; CHECK-LABEL: f4:
     51 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
     52 ; CHECK: vreph %v24, [[REG]], 3
     53 ; CHECK: br %r14
     54   %val = insertelement <8 x i16> undef, i16 %scalar, i32 0
     55   %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
     56                        <8 x i32> zeroinitializer
     57   ret <8 x i16> %ret
     58 }
     59 
     60 ; Test v8i16 splat of the last element.
     61 define <8 x i16> @f5(i16 %scalar) {
     62 ; CHECK-LABEL: f5:
     63 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
     64 ; CHECK: vreph %v24, [[REG]], 3
     65 ; CHECK: br %r14
     66   %val = insertelement <8 x i16> undef, i16 %scalar, i32 7
     67   %ret = shufflevector <8 x i16> %val, <8 x i16> undef,
     68                        <8 x i32> <i32 7, i32 7, i32 7, i32 7,
     69                                   i32 7, i32 7, i32 7, i32 7>
     70   ret <8 x i16> %ret
     71 }
     72 
     73 ; Test v8i16 splat of an arbitrary element, using the second operand of
     74 ; the shufflevector.
     75 define <8 x i16> @f6(i16 %scalar) {
     76 ; CHECK-LABEL: f6:
     77 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
     78 ; CHECK: vreph %v24, [[REG]], 3
     79 ; CHECK: br %r14
     80   %val = insertelement <8 x i16> undef, i16 %scalar, i32 2
     81   %ret = shufflevector <8 x i16> undef, <8 x i16> %val,
     82                        <8 x i32> <i32 10, i32 10, i32 10, i32 10,
     83                                   i32 10, i32 10, i32 10, i32 10>
     84   ret <8 x i16> %ret
     85 }
     86 
     87 ; Test v4i32 splat of the first element.
     88 define <4 x i32> @f7(i32 %scalar) {
     89 ; CHECK-LABEL: f7:
     90 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
     91 ; CHECK: vrepf %v24, [[REG]], 1
     92 ; CHECK: br %r14
     93   %val = insertelement <4 x i32> undef, i32 %scalar, i32 0
     94   %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
     95                        <4 x i32> zeroinitializer
     96   ret <4 x i32> %ret
     97 }
     98 
     99 ; Test v4i32 splat of the last element.
    100 define <4 x i32> @f8(i32 %scalar) {
    101 ; CHECK-LABEL: f8:
    102 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
    103 ; CHECK: vrepf %v24, [[REG]], 1
    104 ; CHECK: br %r14
    105   %val = insertelement <4 x i32> undef, i32 %scalar, i32 3
    106   %ret = shufflevector <4 x i32> %val, <4 x i32> undef,
    107                        <4 x i32> <i32 3, i32 3, i32 3, i32 3>
    108   ret <4 x i32> %ret
    109 }
    110 
    111 ; Test v4i32 splat of an arbitrary element, using the second operand of
    112 ; the shufflevector.
    113 define <4 x i32> @f9(i32 %scalar) {
    114 ; CHECK-LABEL: f9:
    115 ; CHECK: vlvgp [[REG:%v[0-9]+]], %r2, %r2
    116 ; CHECK: vrepf %v24, [[REG]], 1
    117 ; CHECK: br %r14
    118   %val = insertelement <4 x i32> undef, i32 %scalar, i32 1
    119   %ret = shufflevector <4 x i32> undef, <4 x i32> %val,
    120                        <4 x i32> <i32 5, i32 5, i32 5, i32 5>
    121   ret <4 x i32> %ret
    122 }
    123 
    124 ; Test v2i64 splat of the first element.
    125 define <2 x i64> @f10(i64 %scalar) {
    126 ; CHECK-LABEL: f10:
    127 ; CHECK: vlvgp %v24, %r2, %r2
    128 ; CHECK: br %r14
    129   %val = insertelement <2 x i64> undef, i64 %scalar, i32 0
    130   %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
    131                        <2 x i32> zeroinitializer
    132   ret <2 x i64> %ret
    133 }
    134 
    135 ; Test v2i64 splat of the last element.
    136 define <2 x i64> @f11(i64 %scalar) {
    137 ; CHECK-LABEL: f11:
    138 ; CHECK: vlvgp %v24, %r2, %r2
    139 ; CHECK: br %r14
    140   %val = insertelement <2 x i64> undef, i64 %scalar, i32 1
    141   %ret = shufflevector <2 x i64> %val, <2 x i64> undef,
    142                        <2 x i32> <i32 1, i32 1>
    143   ret <2 x i64> %ret
    144 }
    145 
    146 ; Test v4f32 splat of the first element.
    147 define <4 x float> @f12(float %scalar) {
    148 ; CHECK-LABEL: f12:
    149 ; CHECK: vrepf %v24, %v0, 0
    150 ; CHECK: br %r14
    151   %val = insertelement <4 x float> undef, float %scalar, i32 0
    152   %ret = shufflevector <4 x float> %val, <4 x float> undef,
    153                        <4 x i32> zeroinitializer
    154   ret <4 x float> %ret
    155 }
    156 
    157 ; Test v4f32 splat of the last element.
    158 define <4 x float> @f13(float %scalar) {
    159 ; CHECK-LABEL: f13:
    160 ; CHECK: vrepf %v24, %v0, 0
    161 ; CHECK: br %r14
    162   %val = insertelement <4 x float> undef, float %scalar, i32 3
    163   %ret = shufflevector <4 x float> %val, <4 x float> undef,
    164                        <4 x i32> <i32 3, i32 3, i32 3, i32 3>
    165   ret <4 x float> %ret
    166 }
    167 
    168 ; Test v4f32 splat of an arbitrary element, using the second operand of
    169 ; the shufflevector.
    170 define <4 x float> @f14(float %scalar) {
    171 ; CHECK-LABEL: f14:
    172 ; CHECK: vrepf %v24, %v0, 0
    173 ; CHECK: br %r14
    174   %val = insertelement <4 x float> undef, float %scalar, i32 1
    175   %ret = shufflevector <4 x float> undef, <4 x float> %val,
    176                        <4 x i32> <i32 5, i32 5, i32 5, i32 5>
    177   ret <4 x float> %ret
    178 }
    179 
    180 ; Test v2f64 splat of the first element.
    181 define <2 x double> @f15(double %scalar) {
    182 ; CHECK-LABEL: f15:
    183 ; CHECK: vrepg %v24, %v0, 0
    184 ; CHECK: br %r14
    185   %val = insertelement <2 x double> undef, double %scalar, i32 0
    186   %ret = shufflevector <2 x double> %val, <2 x double> undef,
    187                        <2 x i32> zeroinitializer
    188   ret <2 x double> %ret
    189 }
    190 
    191 ; Test v2f64 splat of the last element.
    192 define <2 x double> @f16(double %scalar) {
    193 ; CHECK-LABEL: f16:
    194 ; CHECK: vrepg %v24, %v0, 0
    195 ; CHECK: br %r14
    196   %val = insertelement <2 x double> undef, double %scalar, i32 1
    197   %ret = shufflevector <2 x double> %val, <2 x double> undef,
    198                        <2 x i32> <i32 1, i32 1>
    199   ret <2 x double> %ret
    200 }
    201