1 ; RUN: opt -passes=instcombine -S < %s | FileCheck %s
3 ; This vscale udiv with a power-of-2 spalt on the rhs should not crash opt
5 ; CHECK: define <vscale x 2 x i32> @udiv_pow2_vscale(<vscale x 2 x i32> %lhs)
6 define <vscale x 2 x i32> @udiv_pow2_vscale(<vscale x 2 x i32> %lhs) {
7 %splatter = insertelement <vscale x 2 x i32> undef, i32 2, i32 0
8 %rhs = shufflevector <vscale x 2 x i32> %splatter,
9 <vscale x 2 x i32> undef,
10 <vscale x 2 x i32> zeroinitializer
11 %res = udiv <vscale x 2 x i32> %lhs, %rhs
12 ret <vscale x 2 x i32> %res
15 ; This fixed width udiv with a power-of-2 splat on the rhs should also not
16 ; crash, and instcombine should eliminate the udiv
18 ; CHECK-LABEL: define <2 x i32> @udiv_pow2_fixed(<2 x i32> %lhs)
20 define <2 x i32> @udiv_pow2_fixed(<2 x i32> %lhs) {
21 %splatter = insertelement <2 x i32> undef, i32 2, i32 0
22 %rhs = shufflevector <2 x i32> %splatter,
24 <2 x i32> zeroinitializer
25 %res = udiv <2 x i32> %lhs, %rhs