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 3# 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 6# operand. 7# 8# This test covers the case when OtherInsnID and OtherOpIdx are different in a 9# GIM_CheckIsSameOperand. 10 11--- 12name: test_blsi32rr 13alignment: 4 14legalized: true 15regBankSelected: true 16registers: 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: $edi 25 26 ; CHECK-LABEL: name: test_blsi32rr 27 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi 28 ; CHECK: [[BLSI32rr:%[0-9]+]]:gr32 = BLSI32rr [[COPY]], implicit-def $eflags 29 ; CHECK: $edi = COPY [[BLSI32rr]] 30 %0(s32) = COPY $edi 31 %1(s32) = G_CONSTANT i32 0 32 %2(s32) = G_SUB %1, %0 33 %3(s32) = G_AND %2, %0 34 $edi = COPY %3 35 36... 37--- 38name: test_blsi32rr_nomatch 39alignment: 4 40legalized: true 41regBankSelected: true 42registers: 43 - { id: 0, class: gpr } 44 - { id: 1, class: gpr } 45 - { id: 2, class: gpr } 46 - { id: 3, class: gpr } 47# G_SUB and G_AND use different operands so we shouldn't match this. 48body: | 49 bb.1: 50 liveins: $edi 51 52 ; CHECK-LABEL: name: test_blsi32rr_nomatch 53 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi 54 ; CHECK: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def $eflags 55 ; CHECK: [[SUB32ri:%[0-9]+]]:gr32 = SUB32ri8 [[MOV32r0_]], 0, implicit-def $eflags 56 ; CHECK: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[SUB32ri]], [[COPY]], implicit-def $eflags 57 ; CHECK: $edi = COPY [[AND32rr]] 58 %0(s32) = COPY $edi 59 %1(s32) = G_CONSTANT i32 0 60 %2(s32) = G_SUB %1, %1 61 %3(s32) = G_AND %2, %0 62 $edi = COPY %3 63... 64