69 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mtriple=x86_64-linux-gnu -mattr=+bmi -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s3#4# Test that rules where multiple operands must be the same operand successfully5# match. Also test that the rules do not match when they're not the same6# operand.7#8# This test covers the case when OtherInsnID and OtherOpIdx are different in a9# GIM_CheckIsSameOperand.10 11---12name: test_blsi32rr13alignment: 1614legalized: true15regBankSelected: true16registers: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.22body: |23 bb.1:24 liveins: $edi25 26 ; CHECK-LABEL: name: test_blsi32rr27 ; CHECK: liveins: $edi28 ; CHECK-NEXT: {{ $}}29 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi30 ; CHECK-NEXT: [[NEG32r:%[0-9]+]]:gr32 = NEG32r [[COPY]], implicit-def dead $eflags31 ; CHECK-NEXT: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[NEG32r]], [[COPY]], implicit-def dead $eflags32 ; CHECK-NEXT: $edi = COPY [[AND32rr]]33 %0(s32) = COPY $edi34 %1(s32) = G_CONSTANT i32 035 %2(s32) = G_SUB %1, %036 %3(s32) = G_AND %2, %037 $edi = COPY %338 39...40---41name: test_blsi32rr_nomatch42alignment: 1643legalized: true44regBankSelected: true45registers: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.51body: |52 bb.1:53 liveins: $edi54 55 ; CHECK-LABEL: name: test_blsi32rr_nomatch56 ; CHECK: liveins: $edi57 ; CHECK-NEXT: {{ $}}58 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi59 ; CHECK-NEXT: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags60 ; CHECK-NEXT: [[NEG32r:%[0-9]+]]:gr32 = NEG32r [[MOV32r0_]], implicit-def dead $eflags61 ; CHECK-NEXT: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[NEG32r]], [[COPY]], implicit-def dead $eflags62 ; CHECK-NEXT: $edi = COPY [[AND32rr]]63 %0(s32) = COPY $edi64 %1(s32) = G_CONSTANT i32 065 %2(s32) = G_SUB %1, %166 %3(s32) = G_AND %2, %067 $edi = COPY %368...69