1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S -o - | FileCheck %s
4 ; When both operands are undef in a lane, that lane should produce an undef result.
6 define <3 x i8> @shl() {
8 ; CHECK-NEXT: ret <3 x i8> <i8 poison, i8 0, i8 0>
10 %c = shl <3 x i8> undef, <i8 undef, i8 4, i8 1>
14 define <3 x i8> @and() {
16 ; CHECK-NEXT: ret <3 x i8> <i8 undef, i8 0, i8 undef>
18 %c = and <3 x i8> <i8 undef, i8 42, i8 undef>, undef
22 define <3 x i8> @and_commute() {
23 ; CHECK-LABEL: @and_commute(
24 ; CHECK-NEXT: ret <3 x i8> <i8 0, i8 0, i8 undef>
26 %c = and <3 x i8> undef, <i8 -42, i8 42, i8 undef>
30 define <3 x i8> @or() {
32 ; CHECK-NEXT: ret <3 x i8> <i8 undef, i8 -1, i8 undef>
34 %c = or <3 x i8> <i8 undef, i8 42, i8 undef>, undef
38 define <3 x i8> @or_commute() {
39 ; CHECK-LABEL: @or_commute(
40 ; CHECK-NEXT: ret <3 x i8> <i8 -1, i8 -1, i8 undef>
42 %c = or <3 x i8> undef, <i8 -42, i8 42, i8 undef>
46 define <3 x float> @fadd() {
48 ; CHECK-NEXT: ret <3 x float> <float undef, float 0x7FF8000000000000, float undef>
50 %c = fadd <3 x float> <float undef, float 42.0, float undef>, undef
54 define <3 x float> @fadd_commute() {
55 ; CHECK-LABEL: @fadd_commute(
56 ; CHECK-NEXT: ret <3 x float> <float 0x7FF8000000000000, float 0x7FF8000000000000, float undef>
58 %c = fadd <3 x float> undef, <float -42.0, float 42.0, float undef>
62 define <4 x i32> @shuffle_of_undefs(<4 x i32> %v1, <4 x i32> %v2) {
63 ; CHECK-LABEL: @shuffle_of_undefs(
64 ; CHECK-NEXT: ret <4 x i32> <i32 poison, i32 undef, i32 undef, i32 undef>
66 %r = shufflevector <4 x i32> undef, <4 x i32> poison, <4 x i32> <i32 5, i32 1, i32 2, i32 3>