1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -passes=instsimplify,verify -S | FileCheck %s 3 4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 5;; Unary Operations 6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 8define <vscale x 2 x double> @fneg(<vscale x 2 x double> %val) { 9; CHECK-LABEL: @fneg( 10; CHECK-NEXT: ret <vscale x 2 x double> undef 11; 12 %r = fneg <vscale x 2 x double> undef 13 ret <vscale x 2 x double> %r 14} 15 16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 17;; Binary Operations 18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 19 20define <vscale x 4 x i32> @add() { 21; CHECK-LABEL: @add( 22; CHECK-NEXT: ret <vscale x 4 x i32> undef 23; 24 %r = add <vscale x 4 x i32> undef, undef 25 ret <vscale x 4 x i32> %r 26} 27 28define <vscale x 4 x float> @fadd() { 29; CHECK-LABEL: @fadd( 30; CHECK-NEXT: ret <vscale x 4 x float> undef 31; 32 %r = fadd <vscale x 4 x float> undef, undef 33 ret <vscale x 4 x float> %r 34} 35 36define <vscale x 4 x i32> @sub() { 37; CHECK-LABEL: @sub( 38; CHECK-NEXT: ret <vscale x 4 x i32> undef 39; 40 %r = sub <vscale x 4 x i32> undef, undef 41 ret <vscale x 4 x i32> %r 42} 43 44define <vscale x 4 x i32> @sub_splat() { 45; CHECK-LABEL: @sub_splat( 46; CHECK-NEXT: ret <vscale x 4 x i32> splat (i32 -16) 47; 48 %r = sub <vscale x 4 x i32> zeroinitializer, splat (i32 16) 49 ret <vscale x 4 x i32> %r 50} 51 52define <vscale x 4 x float> @fsub() { 53; CHECK-LABEL: @fsub( 54; CHECK-NEXT: ret <vscale x 4 x float> undef 55; 56 %r = fsub <vscale x 4 x float> undef, undef 57 ret <vscale x 4 x float> %r 58} 59 60define <vscale x 4 x i32> @mul() { 61; CHECK-LABEL: @mul( 62; CHECK-NEXT: ret <vscale x 4 x i32> undef 63; 64 %r = mul <vscale x 4 x i32> undef, undef 65 ret <vscale x 4 x i32> %r 66} 67 68define <vscale x 4 x float> @fmul() { 69; CHECK-LABEL: @fmul( 70; CHECK-NEXT: ret <vscale x 4 x float> undef 71; 72 %r = fmul <vscale x 4 x float> undef, undef 73 ret <vscale x 4 x float> %r 74} 75 76define <vscale x 4 x i32> @udiv() { 77; CHECK-LABEL: @udiv( 78; CHECK-NEXT: ret <vscale x 4 x i32> poison 79; 80 %r = udiv <vscale x 4 x i32> undef, undef 81 ret <vscale x 4 x i32> %r 82} 83 84define <vscale x 4 x i32> @udiv_splat_zero() { 85; CHECK-LABEL: @udiv_splat_zero( 86; CHECK-NEXT: ret <vscale x 4 x i32> poison 87; 88 %r = udiv <vscale x 4 x i32> zeroinitializer, zeroinitializer 89 ret <vscale x 4 x i32> %r 90} 91 92define <vscale x 4 x i32> @sdiv() { 93; CHECK-LABEL: @sdiv( 94; CHECK-NEXT: ret <vscale x 4 x i32> poison 95; 96 %r = sdiv <vscale x 4 x i32> undef, undef 97 ret <vscale x 4 x i32> %r 98} 99 100define <vscale x 4 x float> @fdiv() { 101; CHECK-LABEL: @fdiv( 102; CHECK-NEXT: ret <vscale x 4 x float> undef 103; 104 %r = fdiv <vscale x 4 x float> undef, undef 105 ret <vscale x 4 x float> %r 106} 107 108define <vscale x 4 x i32> @urem() { 109; CHECK-LABEL: @urem( 110; CHECK-NEXT: ret <vscale x 4 x i32> poison 111; 112 %r = urem <vscale x 4 x i32> undef, undef 113 ret <vscale x 4 x i32> %r 114} 115 116define <vscale x 4 x i32> @srem() { 117; CHECK-LABEL: @srem( 118; CHECK-NEXT: ret <vscale x 4 x i32> poison 119; 120 %r = srem <vscale x 4 x i32> undef, undef 121 ret <vscale x 4 x i32> %r 122} 123 124define <vscale x 4 x float> @frem() { 125; CHECK-LABEL: @frem( 126; CHECK-NEXT: ret <vscale x 4 x float> undef 127; 128 %r = frem <vscale x 4 x float> undef, undef 129 ret <vscale x 4 x float> %r 130} 131 132;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 133;; Bitwise Binary Operations 134;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 135 136define <vscale x 4 x i32> @shl() { 137; CHECK-LABEL: @shl( 138; CHECK-NEXT: ret <vscale x 4 x i32> poison 139; 140 %r = shl <vscale x 4 x i32> undef, undef 141 ret <vscale x 4 x i32> %r 142} 143 144define <vscale x 4 x i32> @lshr() { 145; CHECK-LABEL: @lshr( 146; CHECK-NEXT: ret <vscale x 4 x i32> poison 147; 148 %r = lshr <vscale x 4 x i32> undef, undef 149 ret <vscale x 4 x i32> %r 150} 151 152define <vscale x 4 x i32> @ashr() { 153; CHECK-LABEL: @ashr( 154; CHECK-NEXT: ret <vscale x 4 x i32> poison 155; 156 %r = ashr <vscale x 4 x i32> undef, undef 157 ret <vscale x 4 x i32> %r 158} 159 160define <vscale x 4 x i32> @and() { 161; CHECK-LABEL: @and( 162; CHECK-NEXT: ret <vscale x 4 x i32> undef 163; 164 %r = and <vscale x 4 x i32> undef, undef 165 ret <vscale x 4 x i32> %r 166} 167 168define <vscale x 4 x i32> @or() { 169; CHECK-LABEL: @or( 170; CHECK-NEXT: ret <vscale x 4 x i32> undef 171; 172 %r = or <vscale x 4 x i32> undef, undef 173 ret <vscale x 4 x i32> %r 174} 175 176define <vscale x 4 x i32> @xor() { 177; CHECK-LABEL: @xor( 178; CHECK-NEXT: ret <vscale x 4 x i32> zeroinitializer 179; 180 %r = xor <vscale x 4 x i32> undef, undef 181 ret <vscale x 4 x i32> %r 182} 183 184;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 185;; Vector Operations 186;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 187 188define <vscale x 4 x i32> @insertelement() { 189; CHECK-LABEL: @insertelement( 190; CHECK-NEXT: ret <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i32 0) 191; 192 %i = insertelement <vscale x 4 x i32> undef, i32 1, i32 0 193 ret <vscale x 4 x i32> %i 194} 195 196define <vscale x 4 x i32> @shufflevector() { 197; CHECK-LABEL: @shufflevector( 198; CHECK-NEXT: ret <vscale x 4 x i32> splat (i32 1) 199; 200 %i = insertelement <vscale x 4 x i32> undef, i32 1, i32 0 201 %i2 = shufflevector <vscale x 4 x i32> %i, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer 202 ret <vscale x 4 x i32> %i2 203} 204 205;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 206;; Conversion Operations 207;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 208 209define <vscale x 4 x float> @bitcast() { 210; CHECK-LABEL: @bitcast( 211; CHECK-NEXT: ret <vscale x 4 x float> bitcast (<vscale x 4 x i32> splat (i32 1) to <vscale x 4 x float>) 212; 213 %i1 = insertelement <vscale x 4 x i32> undef, i32 1, i32 0 214 %i2 = shufflevector <vscale x 4 x i32> %i1, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer 215 %i3 = bitcast <vscale x 4 x i32> %i2 to <vscale x 4 x float> 216 ret <vscale x 4 x float> %i3 217} 218 219;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 220;; Other Operations 221;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 222 223define <vscale x 4 x i32> @select() { 224; CHECK-LABEL: @select( 225; CHECK-NEXT: ret <vscale x 4 x i32> undef 226; 227 %r = select <vscale x 4 x i1> undef, <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> undef 228 ret <vscale x 4 x i32> %r 229} 230 231declare <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8>, <vscale x 16 x i8>) 232 233define <vscale x 16 x i8> @call() { 234; CHECK-LABEL: @call( 235; CHECK-NEXT: [[R:%.*]] = call <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8> undef, <vscale x 16 x i8> undef) 236; CHECK-NEXT: ret <vscale x 16 x i8> [[R]] 237; 238 %r = call <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8> undef, <vscale x 16 x i8> undef) 239 ret <vscale x 16 x i8> %r 240} 241 242define <vscale x 4 x i1> @icmp_undef() { 243; CHECK-LABEL: @icmp_undef( 244; CHECK-NEXT: ret <vscale x 4 x i1> undef 245; 246 %r = icmp eq <vscale x 4 x i32> undef, undef 247 ret <vscale x 4 x i1> %r 248} 249 250define <vscale x 4 x i1> @icmp_zero() { 251; CHECK-LABEL: @icmp_zero( 252; CHECK-NEXT: ret <vscale x 4 x i1> splat (i1 true) 253; 254 %r = icmp eq <vscale x 4 x i32> zeroinitializer, zeroinitializer 255 ret <vscale x 4 x i1> %r 256} 257 258define <vscale x 4 x i1> @fcmp_true() { 259; CHECK-LABEL: @fcmp_true( 260; CHECK-NEXT: ret <vscale x 4 x i1> splat (i1 true) 261; 262 %r = fcmp true <vscale x 4 x float> undef, undef 263 ret <vscale x 4 x i1> %r 264} 265 266define <vscale x 4 x i1> @fcmp_false() { 267; CHECK-LABEL: @fcmp_false( 268; CHECK-NEXT: ret <vscale x 4 x i1> zeroinitializer 269; 270 %r = fcmp false <vscale x 4 x float> undef, undef 271 ret <vscale x 4 x i1> %r 272} 273 274define <vscale x 4 x i1> @fcmp_undef() { 275; CHECK-LABEL: @fcmp_undef( 276; CHECK-NEXT: ret <vscale x 4 x i1> undef 277; 278 %r = icmp ne <vscale x 4 x i32> undef, undef 279 ret <vscale x 4 x i1> %r 280} 281 282define <vscale x 4 x i1> @fcmp_not_equality() { 283; CHECK-LABEL: @fcmp_not_equality( 284; CHECK-NEXT: ret <vscale x 4 x i1> splat (i1 true) 285; 286 %r = icmp ule <vscale x 4 x i32> undef, zeroinitializer 287 ret <vscale x 4 x i1> %r 288} 289