1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -instsimplify -S -verify | 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> shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 -16, i32 0), <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer) 47; 48 %r = sub <vscale x 4 x i32> zeroinitializer, shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 16, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer) 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> shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer) 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;; Memory Access and Addressing Operations 207;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 208 209define <vscale x 2 x double> @load() { 210; CHECK-LABEL: @load( 211; CHECK-NEXT: [[R:%.*]] = load <vscale x 2 x double>, ptr getelementptr (<vscale x 2 x double>, ptr null, i64 1), align 16 212; CHECK-NEXT: ret <vscale x 2 x double> [[R]] 213; 214 %r = load <vscale x 2 x double>, ptr getelementptr (<vscale x 2 x double>, ptr null, i64 1) 215 ret <vscale x 2 x double> %r 216} 217 218;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 219;; Conversion Operations 220;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 221 222define <vscale x 4 x float> @bitcast() { 223; CHECK-LABEL: @bitcast( 224; CHECK-NEXT: ret <vscale x 4 x float> bitcast (<vscale x 4 x i32> shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer) to <vscale x 4 x float>) 225; 226 %i1 = insertelement <vscale x 4 x i32> undef, i32 1, i32 0 227 %i2 = shufflevector <vscale x 4 x i32> %i1, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer 228 %i3 = bitcast <vscale x 4 x i32> %i2 to <vscale x 4 x float> 229 ret <vscale x 4 x float> %i3 230} 231 232;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 233;; Other Operations 234;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 235 236define <vscale x 4 x i32> @select() { 237; CHECK-LABEL: @select( 238; CHECK-NEXT: ret <vscale x 4 x i32> undef 239; 240 %r = select <vscale x 4 x i1> undef, <vscale x 4 x i32> zeroinitializer, <vscale x 4 x i32> undef 241 ret <vscale x 4 x i32> %r 242} 243 244declare <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8>, <vscale x 16 x i8>) 245 246define <vscale x 16 x i8> @call() { 247; CHECK-LABEL: @call( 248; CHECK-NEXT: [[R:%.*]] = call <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8> undef, <vscale x 16 x i8> undef) 249; CHECK-NEXT: ret <vscale x 16 x i8> [[R]] 250; 251 %r = call <vscale x 16 x i8> @llvm.something(<vscale x 16 x i8> undef, <vscale x 16 x i8> undef) 252 ret <vscale x 16 x i8> %r 253} 254 255define <vscale x 4 x i1> @icmp_undef() { 256; CHECK-LABEL: @icmp_undef( 257; CHECK-NEXT: ret <vscale x 4 x i1> undef 258; 259 %r = icmp eq <vscale x 4 x i32> undef, undef 260 ret <vscale x 4 x i1> %r 261} 262 263define <vscale x 4 x i1> @icmp_zero() { 264; CHECK-LABEL: @icmp_zero( 265; CHECK-NEXT: ret <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer) 266; 267 %r = icmp eq <vscale x 4 x i32> zeroinitializer, zeroinitializer 268 ret <vscale x 4 x i1> %r 269} 270 271define <vscale x 4 x i1> @fcmp_true() { 272; CHECK-LABEL: @fcmp_true( 273; CHECK-NEXT: ret <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer) 274; 275 %r = fcmp true <vscale x 4 x float> undef, undef 276 ret <vscale x 4 x i1> %r 277} 278 279define <vscale x 4 x i1> @fcmp_false() { 280; CHECK-LABEL: @fcmp_false( 281; CHECK-NEXT: ret <vscale x 4 x i1> zeroinitializer 282; 283 %r = fcmp false <vscale x 4 x float> undef, undef 284 ret <vscale x 4 x i1> %r 285} 286 287define <vscale x 4 x i1> @fcmp_undef() { 288; CHECK-LABEL: @fcmp_undef( 289; CHECK-NEXT: ret <vscale x 4 x i1> undef 290; 291 %r = icmp ne <vscale x 4 x i32> undef, undef 292 ret <vscale x 4 x i1> %r 293} 294 295define <vscale x 4 x i1> @fcmp_not_equality() { 296; CHECK-LABEL: @fcmp_not_equality( 297; CHECK-NEXT: ret <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer) 298; 299 %r = icmp ule <vscale x 4 x i32> undef, zeroinitializer 300 ret <vscale x 4 x i1> %r 301} 302