1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -mattr=+bmi -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
4 # Test that rules where multiple operands must be the same operand successfully
5 # match. Also test that the rules do not match when they're not the same
8 # This test covers the case when OtherInsnID and OtherOpIdx are different in a
9 # GIM_CheckIsSameOperand.
17 - { id: 0, class: gpr }
18 - { id: 1, class: gpr }
19 - { id: 2, class: gpr }
20 - { id: 3, class: gpr }
21 # G_SUB and G_AND both use %0 so we should match this.
26 ; CHECK-LABEL: name: test_blsi32rr
27 ; CHECK: liveins: $edi
29 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
30 ; CHECK-NEXT: [[NEG32r:%[0-9]+]]:gr32 = NEG32r [[COPY]], implicit-def dead $eflags
31 ; CHECK-NEXT: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[NEG32r]], [[COPY]], implicit-def dead $eflags
32 ; CHECK-NEXT: $edi = COPY [[AND32rr]]
34 %1(s32) = G_CONSTANT i32 0
35 %2(s32) = G_SUB %1, %0
36 %3(s32) = G_AND %2, %0
41 name: test_blsi32rr_nomatch
46 - { id: 0, class: gpr }
47 - { id: 1, class: gpr }
48 - { id: 2, class: gpr }
49 - { id: 3, class: gpr }
50 # G_SUB and G_AND use different operands so we shouldn't match this.
55 ; CHECK-LABEL: name: test_blsi32rr_nomatch
56 ; CHECK: liveins: $edi
58 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
59 ; CHECK-NEXT: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags
60 ; CHECK-NEXT: [[NEG32r:%[0-9]+]]:gr32 = NEG32r [[MOV32r0_]], implicit-def dead $eflags
61 ; CHECK-NEXT: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[NEG32r]], [[COPY]], implicit-def dead $eflags
62 ; CHECK-NEXT: $edi = COPY [[AND32rr]]
64 %1(s32) = G_CONSTANT i32 0
65 %2(s32) = G_SUB %1, %1
66 %3(s32) = G_AND %2, %0