1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 define <4 x i32> @test_v4i32_splatconst_pow2(<4 x i32> %a0) {
5 ; CHECK-LABEL: @test_v4i32_splatconst_pow2(
6 ; CHECK-NEXT: [[TMP1:%.*]] = and <4 x i32> [[A0:%.*]], <i32 1, i32 1, i32 1, i32 1>
7 ; CHECK-NEXT: ret <4 x i32> [[TMP1]]
9 %1 = urem <4 x i32> %a0, <i32 2, i32 2, i32 2, i32 2>
13 define <4 x i32> @test_v4i32_const_pow2(<4 x i32> %a0) {
14 ; CHECK-LABEL: @test_v4i32_const_pow2(
15 ; CHECK-NEXT: [[TMP1:%.*]] = and <4 x i32> [[A0:%.*]], <i32 0, i32 1, i32 3, i32 7>
16 ; CHECK-NEXT: ret <4 x i32> [[TMP1]]
18 %1 = urem <4 x i32> %a0, <i32 1, i32 2, i32 4, i32 8>
22 define <4 x i32> @test_v4i32_const_pow2_undef(<4 x i32> %a0) {
23 ; CHECK-LABEL: @test_v4i32_const_pow2_undef(
24 ; CHECK-NEXT: ret <4 x i32> poison
26 %1 = urem <4 x i32> %a0, <i32 1, i32 2, i32 4, i32 undef>
30 define <4 x i32> @test_v4i32_one(<4 x i32> %a0) {
31 ; CHECK-LABEL: @test_v4i32_one(
32 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <4 x i32> [[A0:%.*]], <i32 1, i32 1, i32 1, i32 1>
33 ; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i1> [[TMP1]] to <4 x i32>
34 ; CHECK-NEXT: ret <4 x i32> [[TMP2]]
36 %1 = urem <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %a0
40 define <4 x i32> @test_v4i32_one_undef(<4 x i32> %a0) {
41 ; CHECK-LABEL: @test_v4i32_one_undef(
42 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne <4 x i32> [[A0:%.*]], <i32 1, i32 1, i32 1, i32 1>
43 ; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i1> [[TMP1]] to <4 x i32>
44 ; CHECK-NEXT: ret <4 x i32> [[TMP2]]
46 %1 = urem <4 x i32> <i32 1, i32 1, i32 1, i32 undef>, %a0
50 define <4 x i32> @test_v4i32_negconstsplat(<4 x i32> %a0) {
51 ; CHECK-LABEL: @test_v4i32_negconstsplat(
52 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult <4 x i32> [[A0:%.*]], <i32 -3, i32 -3, i32 -3, i32 -3>
53 ; CHECK-NEXT: [[TMP2:%.*]] = add <4 x i32> [[A0]], <i32 3, i32 3, i32 3, i32 3>
54 ; CHECK-NEXT: [[TMP3:%.*]] = select <4 x i1> [[TMP1]], <4 x i32> [[A0]], <4 x i32> [[TMP2]]
55 ; CHECK-NEXT: ret <4 x i32> [[TMP3]]
57 %1 = urem <4 x i32> %a0, <i32 -3, i32 -3, i32 -3, i32 -3>
61 define <4 x i32> @test_v4i32_negconst(<4 x i32> %a0) {
62 ; CHECK-LABEL: @test_v4i32_negconst(
63 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ult <4 x i32> [[A0:%.*]], <i32 -3, i32 -5, i32 -7, i32 -9>
64 ; CHECK-NEXT: [[TMP2:%.*]] = add <4 x i32> [[A0]], <i32 3, i32 5, i32 7, i32 9>
65 ; CHECK-NEXT: [[TMP3:%.*]] = select <4 x i1> [[TMP1]], <4 x i32> [[A0]], <4 x i32> [[TMP2]]
66 ; CHECK-NEXT: ret <4 x i32> [[TMP3]]
68 %1 = urem <4 x i32> %a0, <i32 -3, i32 -5, i32 -7, i32 -9>
72 define <4 x i32> @test_v4i32_negconst_undef(<4 x i32> %a0) {
73 ; CHECK-LABEL: @test_v4i32_negconst_undef(
74 ; CHECK-NEXT: ret <4 x i32> poison
76 %1 = urem <4 x i32> %a0, <i32 -3, i32 -5, i32 -7, i32 undef>