; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 ; RUN: llc -mtriple=aarch64 -mattr=+sve < %s -o - | FileCheck --check-prefixes=CHECK,SVE %s ; RUN: llc -mtriple=aarch64 -mattr=+sve2 < %s -o - | FileCheck --check-prefixes=CHECK,SVE2 %s define @testLeftGood16x8( %src1, %src2) { ; SVE-LABEL: testLeftGood16x8: ; SVE: // %bb.0: ; SVE-NEXT: and z0.b, z0.b, #0x7 ; SVE-NEXT: lsl z1.b, z1.b, #3 ; SVE-NEXT: orr z0.d, z0.d, z1.d ; SVE-NEXT: ret ; ; SVE2-LABEL: testLeftGood16x8: ; SVE2: // %bb.0: ; SVE2-NEXT: sli z0.b, z1.b, #3 ; SVE2-NEXT: ret %and.i = and %src1, splat(i8 7) %vshl_n = shl %src2, splat(i8 3) %result = or %and.i, %vshl_n ret %result } define @testLeftBad16x8( %src1, %src2) { ; CHECK-LABEL: testLeftBad16x8: ; CHECK: // %bb.0: ; CHECK-NEXT: mov z2.b, #-91 // =0xffffffffffffffa5 ; CHECK-NEXT: lsl z1.b, z1.b, #1 ; CHECK-NEXT: and z0.d, z0.d, z2.d ; CHECK-NEXT: orr z0.d, z0.d, z1.d ; CHECK-NEXT: ret %and.i = and %src1, splat(i8 165) %vshl_n = shl %src2, splat(i8 1) %result = or %and.i, %vshl_n ret %result } define @testRightGood16x8( %src1, %src2) { ; SVE-LABEL: testRightGood16x8: ; SVE: // %bb.0: ; SVE-NEXT: and z0.b, z0.b, #0xe0 ; SVE-NEXT: lsr z1.b, z1.b, #3 ; SVE-NEXT: orr z0.d, z0.d, z1.d ; SVE-NEXT: ret ; ; SVE2-LABEL: testRightGood16x8: ; SVE2: // %bb.0: ; SVE2-NEXT: sri z0.b, z1.b, #3 ; SVE2-NEXT: ret %and.i = and %src1, splat(i8 224) %vshl_n = lshr %src2, splat(i8 3) %result = or %and.i, %vshl_n ret %result } define @testRightBad16x8( %src1, %src2) { ; CHECK-LABEL: testRightBad16x8: ; CHECK: // %bb.0: ; CHECK-NEXT: mov z2.b, #-91 // =0xffffffffffffffa5 ; CHECK-NEXT: lsr z1.b, z1.b, #1 ; CHECK-NEXT: and z0.d, z0.d, z2.d ; CHECK-NEXT: orr z0.d, z0.d, z1.d ; CHECK-NEXT: ret %and.i = and %src1, splat(i8 165) %vshl_n = lshr %src2, splat(i8 1) %result = or %and.i, %vshl_n ret %result } define @testLeftGood8x16( %src1, %src2) { ; SVE-LABEL: testLeftGood8x16: ; SVE: // %bb.0: ; SVE-NEXT: and z0.h, z0.h, #0x3fff ; SVE-NEXT: lsl z1.h, z1.h, #14 ; SVE-NEXT: orr z0.d, z0.d, z1.d ; SVE-NEXT: ret ; ; SVE2-LABEL: testLeftGood8x16: ; SVE2: // %bb.0: ; SVE2-NEXT: sli z0.h, z1.h, #14 ; SVE2-NEXT: ret %and.i = and %src1, splat(i16 16383) %vshl_n = shl %src2, splat(i16 14) %result = or %and.i, %vshl_n ret %result } define @testLeftBad8x16( %src1, %src2) { ; CHECK-LABEL: testLeftBad8x16: ; CHECK: // %bb.0: ; CHECK-NEXT: mov w8, #16500 // =0x4074 ; CHECK-NEXT: lsl z1.h, z1.h, #14 ; CHECK-NEXT: mov z2.h, w8 ; CHECK-NEXT: and z0.d, z0.d, z2.d ; CHECK-NEXT: orr z0.d, z0.d, z1.d ; CHECK-NEXT: ret %and.i = and %src1, splat(i16 16500) %vshl_n = shl %src2, splat(i16 14) %result = or %and.i, %vshl_n ret %result } define @testRightGood8x16( %src1, %src2) { ; SVE-LABEL: testRightGood8x16: ; SVE: // %bb.0: ; SVE-NEXT: and z0.h, z0.h, #0xfffc ; SVE-NEXT: lsr z1.h, z1.h, #14 ; SVE-NEXT: orr z0.d, z0.d, z1.d ; SVE-NEXT: ret ; ; SVE2-LABEL: testRightGood8x16: ; SVE2: // %bb.0: ; SVE2-NEXT: sri z0.h, z1.h, #14 ; SVE2-NEXT: ret %and.i = and %src1, splat(i16 65532) %vshl_n = lshr %src2, splat(i16 14) %result = or %and.i, %vshl_n ret %result } define @testRightBad8x16( %src1, %src2) { ; CHECK-LABEL: testRightBad8x16: ; CHECK: // %bb.0: ; CHECK-NEXT: mov w8, #16500 // =0x4074 ; CHECK-NEXT: lsr z1.h, z1.h, #14 ; CHECK-NEXT: mov z2.h, w8 ; CHECK-NEXT: and z0.d, z0.d, z2.d ; CHECK-NEXT: orr z0.d, z0.d, z1.d ; CHECK-NEXT: ret %and.i = and %src1, splat(i16 16500) %vshl_n = lshr %src2, splat(i16 14) %result = or %and.i, %vshl_n ret %result } define @testLeftGood4x32( %src1, %src2) { ; SVE-LABEL: testLeftGood4x32: ; SVE: // %bb.0: ; SVE-NEXT: and z0.s, z0.s, #0x3fffff ; SVE-NEXT: lsl z1.s, z1.s, #22 ; SVE-NEXT: orr z0.d, z0.d, z1.d ; SVE-NEXT: ret ; ; SVE2-LABEL: testLeftGood4x32: ; SVE2: // %bb.0: ; SVE2-NEXT: sli z0.s, z1.s, #22 ; SVE2-NEXT: ret %and.i = and %src1, splat(i32 4194303) %vshl_n = shl %src2, splat(i32 22) %result = or %and.i, %vshl_n ret %result } define @testLeftBad4x32( %src1, %src2) { ; CHECK-LABEL: testLeftBad4x32: ; CHECK: // %bb.0: ; CHECK-NEXT: and z0.s, z0.s, #0x3ffffc ; CHECK-NEXT: lsl z1.s, z1.s, #22 ; CHECK-NEXT: orr z0.d, z0.d, z1.d ; CHECK-NEXT: ret %and.i = and %src1, splat(i32 4194300) %vshl_n = shl %src2, splat(i32 22) %result = or %and.i, %vshl_n ret %result } define @testRightGood4x32( %src1, %src2) { ; SVE-LABEL: testRightGood4x32: ; SVE: // %bb.0: ; SVE-NEXT: and z0.s, z0.s, #0xfffffc00 ; SVE-NEXT: lsr z1.s, z1.s, #22 ; SVE-NEXT: orr z0.d, z0.d, z1.d ; SVE-NEXT: ret ; ; SVE2-LABEL: testRightGood4x32: ; SVE2: // %bb.0: ; SVE2-NEXT: sri z0.s, z1.s, #22 ; SVE2-NEXT: ret %and.i = and %src1, splat(i32 4294966272) %vshl_n = lshr %src2, splat(i32 22) %result = or %and.i, %vshl_n ret %result } define @testRightBad4x32( %src1, %src2) { ; CHECK-LABEL: testRightBad4x32: ; CHECK: // %bb.0: ; CHECK-NEXT: and z0.s, z0.s, #0x3ffffc ; CHECK-NEXT: lsr z1.s, z1.s, #22 ; CHECK-NEXT: orr z0.d, z0.d, z1.d ; CHECK-NEXT: ret %and.i = and %src1, splat(i32 4194300) %vshl_n = lshr %src2, splat(i32 22) %result = or %and.i, %vshl_n ret %result } define @testLeftGood2x64( %src1, %src2) { ; SVE-LABEL: testLeftGood2x64: ; SVE: // %bb.0: ; SVE-NEXT: and z0.d, z0.d, #0xffffffffffff ; SVE-NEXT: lsl z1.d, z1.d, #48 ; SVE-NEXT: orr z0.d, z0.d, z1.d ; SVE-NEXT: ret ; ; SVE2-LABEL: testLeftGood2x64: ; SVE2: // %bb.0: ; SVE2-NEXT: sli z0.d, z1.d, #48 ; SVE2-NEXT: ret %and.i = and %src1, splat(i64 281474976710655) %vshl_n = shl %src2, splat(i64 48) %result = or %and.i, %vshl_n ret %result } define @testLeftBad2x64( %src1, %src2) { ; CHECK-LABEL: testLeftBad2x64: ; CHECK: // %bb.0: ; CHECK-NEXT: mov x8, #10 // =0xa ; CHECK-NEXT: lsl z1.d, z1.d, #48 ; CHECK-NEXT: movk x8, #1, lsl #48 ; CHECK-NEXT: mov z2.d, x8 ; CHECK-NEXT: and z0.d, z0.d, z2.d ; CHECK-NEXT: orr z0.d, z0.d, z1.d ; CHECK-NEXT: ret %and.i = and %src1, splat(i64 281474976710666) %vshl_n = shl %src2, splat(i64 48) %result = or %and.i, %vshl_n ret %result } define @testRightGood2x64( %src1, %src2) { ; SVE-LABEL: testRightGood2x64: ; SVE: // %bb.0: ; SVE-NEXT: and z0.d, z0.d, #0xffffffffffff0000 ; SVE-NEXT: lsr z1.d, z1.d, #48 ; SVE-NEXT: orr z0.d, z0.d, z1.d ; SVE-NEXT: ret ; ; SVE2-LABEL: testRightGood2x64: ; SVE2: // %bb.0: ; SVE2-NEXT: sri z0.d, z1.d, #48 ; SVE2-NEXT: ret %and.i = and %src1, splat(i64 18446744073709486080) %vshl_n = lshr %src2, splat(i64 48) %result = or %and.i, %vshl_n ret %result } define @testRightBad2x64( %src1, %src2) { ; CHECK-LABEL: testRightBad2x64: ; CHECK: // %bb.0: ; CHECK-NEXT: mov x8, #10 // =0xa ; CHECK-NEXT: lsr z1.d, z1.d, #48 ; CHECK-NEXT: movk x8, #1, lsl #48 ; CHECK-NEXT: mov z2.d, x8 ; CHECK-NEXT: and z0.d, z0.d, z2.d ; CHECK-NEXT: orr z0.d, z0.d, z1.d ; CHECK-NEXT: ret %and.i = and %src1, splat(i64 281474976710666) %vshl_n = lshr %src2, splat(i64 48) %result = or %and.i, %vshl_n ret %result }