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
14 - { id: 0, class: gpr }
15 - { id: 1, class: gpr }
16 - { id: 2, class: gpr }
17 - { id: 3, class: gpr }
18 # G_ADD and G_AND both use %0 so we should match this.
23 ; CHECK-LABEL: name: test_blsr32rr
24 ; CHECK: liveins: $edi
26 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
27 ; CHECK-NEXT: [[DEC32r:%[0-9]+]]:gr32 = DEC32r [[COPY]], implicit-def dead $eflags
28 ; CHECK-NEXT: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[DEC32r]], [[COPY]], implicit-def dead $eflags
29 ; CHECK-NEXT: $edi = COPY [[AND32rr]]
31 %1(s32) = G_CONSTANT i32 -1
32 %2(s32) = G_ADD %0, %1
33 %3(s32) = G_AND %2, %0
38 name: test_blsr32rr_nomatch
43 - { id: 0, class: gpr }
44 - { id: 1, class: gpr }
45 - { id: 2, class: gpr }
46 - { id: 3, class: gpr }
47 # G_ADD and G_AND use different operands so we shouldn't match this.
52 ; CHECK-LABEL: name: test_blsr32rr_nomatch
53 ; CHECK: liveins: $edi
55 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
56 ; CHECK-NEXT: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri -1
57 ; CHECK-NEXT: [[DEC32r:%[0-9]+]]:gr32 = DEC32r [[MOV32ri]], implicit-def dead $eflags
58 ; CHECK-NEXT: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[DEC32r]], [[COPY]], implicit-def dead $eflags
59 ; CHECK-NEXT: $edi = COPY [[AND32rr]]
61 %1(s32) = G_CONSTANT i32 -1
62 %2(s32) = G_ADD %1, %1
63 %3(s32) = G_AND %2, %0