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--- 9name: test_blsr32rr 10alignment: 4 11legalized: true 12regBankSelected: true 13registers: 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. 19body: | 20 bb.1: 21 liveins: $edi 22 23 ; CHECK-LABEL: name: test_blsr32rr 24 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi 25 ; CHECK: [[BLSR32rr:%[0-9]+]]:gr32 = BLSR32rr [[COPY]], implicit-def $eflags 26 ; CHECK: $edi = COPY [[BLSR32rr]] 27 %0(s32) = COPY $edi 28 %1(s32) = G_CONSTANT i32 -1 29 %2(s32) = G_ADD %0, %1 30 %3(s32) = G_AND %2, %0 31 $edi = COPY %3 32 33... 34--- 35name: test_blsr32rr_nomatch 36alignment: 4 37legalized: true 38regBankSelected: true 39registers: 40 - { id: 0, class: gpr } 41 - { id: 1, class: gpr } 42 - { id: 2, class: gpr } 43 - { id: 3, class: gpr } 44# G_ADD and G_AND use different operands so we shouldn't match this. 45body: | 46 bb.1: 47 liveins: $edi 48 49 ; CHECK-LABEL: name: test_blsr32rr_nomatch 50 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi 51 ; CHECK: [[MOV32ri:%[0-9]+]]:gr32 = MOV32ri 4294967295 52 ; CHECK: [[DEC32r:%[0-9]+]]:gr32 = DEC32r [[MOV32ri]], implicit-def $eflags 53 ; CHECK: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[DEC32r]], [[COPY]], implicit-def $eflags 54 ; CHECK: $edi = COPY [[AND32rr]] 55 %0(s32) = COPY $edi 56 %1(s32) = G_CONSTANT i32 -1 57 %2(s32) = G_ADD %1, %1 58 %3(s32) = G_AND %2, %0 59 $edi = COPY %3 60... 61