File: folding-of-i32-as-i64.mir

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • 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 (128 lines) | stat: -rw-r--r-- 4,567 bytes parent folder | download | duplicates (8)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3
# RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass=si-fold-operands -o - %s | FileCheck -check-prefix=GCN %s

# The constant is 0xffffffff80000000. It is 64-bit negative constant, but it passes the test
# isInt<32>(). Nonetheless it is not a legal literal for a binary or unsigned operand and
# cannot be used right in the shift as HW will zero extend it.

---
name:            imm64_shift_int32_const_0xffffffff80000000
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_shift_int32_const_0xffffffff80000000
    ; GCN: [[S_MOV_B:%[0-9]+]]:sreg_64 = S_MOV_B64_IMM_PSEUDO -2147483648
    ; GCN-NEXT: [[S_LSHL_B64_:%[0-9]+]]:sreg_64 = S_LSHL_B64 [[S_MOV_B]], 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_LSHL_B64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO 18446744071562067968
    %1:sreg_64 = S_LSHL_B64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...

---
name:            imm64_shift_int32_const_0xffffffff
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_shift_int32_const_0xffffffff
    ; GCN: [[S_MOV_B:%[0-9]+]]:sreg_64 = S_MOV_B64_IMM_PSEUDO 4294967295
    ; GCN-NEXT: [[S_LSHL_B64_:%[0-9]+]]:sreg_64 = S_LSHL_B64 [[S_MOV_B]], 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_LSHL_B64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO 4294967295
    %1:sreg_64 = S_LSHL_B64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...

---
name:            imm64_shift_int32_const_0x80000000
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_shift_int32_const_0x80000000
    ; GCN: [[S_MOV_B:%[0-9]+]]:sreg_64 = S_MOV_B64_IMM_PSEUDO 2147483648
    ; GCN-NEXT: [[S_LSHL_B64_:%[0-9]+]]:sreg_64 = S_LSHL_B64 [[S_MOV_B]], 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_LSHL_B64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO 2147483648
    %1:sreg_64 = S_LSHL_B64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...

---
name:            imm64_shift_int32_const_0x7fffffff
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_shift_int32_const_0x7fffffff
    ; GCN: [[S_LSHL_B64_:%[0-9]+]]:sreg_64 = S_LSHL_B64 2147483647, 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_LSHL_B64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO 2147483647
    %1:sreg_64 = S_LSHL_B64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...

---
name:            imm64_shift_int32_const_0x1ffffffff
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_shift_int32_const_0x1ffffffff
    ; GCN: [[S_MOV_B:%[0-9]+]]:sreg_64 = S_MOV_B64_IMM_PSEUDO 8589934591
    ; GCN-NEXT: [[S_LSHL_B64_:%[0-9]+]]:sreg_64 = S_LSHL_B64 [[S_MOV_B]], 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_LSHL_B64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO 8589934591
    %1:sreg_64 = S_LSHL_B64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...

---
name:            imm64_shift_int32_const_0xffffffffffffffff
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_shift_int32_const_0xffffffffffffffff
    ; GCN: [[S_LSHL_B64_:%[0-9]+]]:sreg_64 = S_LSHL_B64 -1, 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_LSHL_B64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO -1
    %1:sreg_64 = S_LSHL_B64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...

---
name:            imm64_ashr_int32_const_0xffffffff
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_ashr_int32_const_0xffffffff
    ; GCN: [[S_MOV_B:%[0-9]+]]:sreg_64 = S_MOV_B64_IMM_PSEUDO 4294967295
    ; GCN-NEXT: [[S_ASHR_I64_:%[0-9]+]]:sreg_64 = S_ASHR_I64 [[S_MOV_B]], 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_ASHR_I64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO 4294967295
    %1:sreg_64 = S_ASHR_I64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...

---
name:            imm64_ashr_int32_const_0x7fffffff
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_ashr_int32_const_0x7fffffff
    ; GCN: [[S_ASHR_I64_:%[0-9]+]]:sreg_64 = S_ASHR_I64 2147483647, 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_ASHR_I64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO 2147483647
    %1:sreg_64 = S_ASHR_I64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...

---
name:            imm64_ashr_int32_const_0xffffffffffffffff
body: |
  bb.0:
    ; GCN-LABEL: name: imm64_ashr_int32_const_0xffffffffffffffff
    ; GCN: [[S_ASHR_I64_:%[0-9]+]]:sreg_64 = S_ASHR_I64 -1, 1, implicit-def $scc
    ; GCN-NEXT: S_ENDPGM 0, implicit [[S_ASHR_I64_]]
    %0:sreg_64 = S_MOV_B64_IMM_PSEUDO -1
    %1:sreg_64 = S_ASHR_I64 %0, 1, implicit-def $scc
    S_ENDPGM 0, implicit %1

...