File: select-blsi.mir

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (69 lines) | stat: -rw-r--r-- 2,337 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-linux-gnu -mattr=+bmi -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
#
# Test that rules where multiple operands must be the same operand successfully
# match. Also test that the rules do not match when they're not the same
# operand.
#
# This test covers the case when OtherInsnID and OtherOpIdx are different in a
# GIM_CheckIsSameOperand.

---
name:            test_blsi32rr
alignment:       16
legalized:       true
regBankSelected: true
registers:
  - { id: 0, class: gpr }
  - { id: 1, class: gpr }
  - { id: 2, class: gpr }
  - { id: 3, class: gpr }
# G_SUB and G_AND both use %0 so we should match this.
body:             |
  bb.1:
    liveins: $edi

    ; CHECK-LABEL: name: test_blsi32rr
    ; CHECK: liveins: $edi
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
    ; CHECK-NEXT: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags
    ; CHECK-NEXT: [[SUB32rr:%[0-9]+]]:gr32 = SUB32rr [[MOV32r0_]], [[COPY]], implicit-def dead $eflags
    ; CHECK-NEXT: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[SUB32rr]], [[COPY]], implicit-def dead $eflags
    ; CHECK-NEXT: $edi = COPY [[AND32rr]]
    %0(s32) = COPY $edi
    %1(s32) = G_CONSTANT i32 0
    %2(s32) = G_SUB %1, %0
    %3(s32) = G_AND %2, %0
    $edi = COPY %3

...
---
name:            test_blsi32rr_nomatch
alignment:       16
legalized:       true
regBankSelected: true
registers:
  - { id: 0, class: gpr }
  - { id: 1, class: gpr }
  - { id: 2, class: gpr }
  - { id: 3, class: gpr }
# G_SUB and G_AND use different operands so we shouldn't match this.
body:             |
  bb.1:
    liveins: $edi

    ; CHECK-LABEL: name: test_blsi32rr_nomatch
    ; CHECK: liveins: $edi
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
    ; CHECK-NEXT: [[MOV32r0_:%[0-9]+]]:gr32 = MOV32r0 implicit-def dead $eflags
    ; CHECK-NEXT: [[SUB32ri:%[0-9]+]]:gr32 = SUB32ri [[MOV32r0_]], 0, implicit-def dead $eflags
    ; CHECK-NEXT: [[AND32rr:%[0-9]+]]:gr32 = AND32rr [[SUB32ri]], [[COPY]], implicit-def dead $eflags
    ; CHECK-NEXT: $edi = COPY [[AND32rr]]
    %0(s32) = COPY $edi
    %1(s32) = G_CONSTANT i32 0
    %2(s32) = G_SUB %1, %1
    %3(s32) = G_AND %2, %0
    $edi = COPY %3
...