# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -o - %s -mtriple=riscv64 -mattr=+c -simplify-mir \
# RUN: -run-pass=riscv-make-compressible | FileCheck %s
--- |
define void @store_common_value(ptr %a, ptr %b, ptr %c) #0 {
entry:
store i64 0, ptr %a, align 8
store i64 0, ptr %b, align 8
store i64 0, ptr %c, align 8
ret void
}
define void @store_common_ptr(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
entry:
store volatile i64 1, ptr %p, align 8
store volatile i64 3, ptr %p, align 8
store volatile i64 5, ptr %p, align 8
ret void
}
define void @store_common_ptr_self(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
entry:
%q = bitcast ptr %p to ptr
store volatile i64 1, ptr %p, align 8
store volatile i64 3, ptr %p, align 8
store volatile ptr %p, ptr %q, align 8
ret void
}
define void @load_common_ptr(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
entry:
%g = load volatile i64, ptr %p, align 8
%h = load volatile i64, ptr %p, align 8
%i = load volatile i64, ptr %p, align 8
ret void
}
define void @store_large_offset(ptr %p) #0 {
entry:
%0 = getelementptr inbounds i64, ptr %p, i64 100
store volatile i64 1, ptr %0, align 8
%1 = getelementptr inbounds i64, ptr %p, i64 101
store volatile i64 3, ptr %1, align 8
%2 = getelementptr inbounds i64, ptr %p, i64 102
store volatile i64 5, ptr %2, align 8
%3 = getelementptr inbounds i64, ptr %p, i64 103
store volatile i64 7, ptr %3, align 8
ret void
}
define void @load_large_offset(ptr %p) #0 {
entry:
%0 = getelementptr inbounds i64, ptr %p, i64 100
%a = load volatile i64, ptr %0, align 8
%1 = getelementptr inbounds i64, ptr %p, i64 101
%b = load volatile i64, ptr %1, align 8
%2 = getelementptr inbounds i64, ptr %p, i64 102
%c = load volatile i64, ptr %2, align 8
%3 = getelementptr inbounds i64, ptr %p, i64 103
%d = load volatile i64, ptr %3, align 8
ret void
}
define void @store_common_value_no_opt(ptr %a) #0 {
entry:
store i64 0, ptr %a, align 8
ret void
}
define void @store_common_ptr_no_opt(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
entry:
store volatile i64 1, ptr %p, align 8
ret void
}
define void @load_common_ptr_no_opt(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
entry:
%g = load volatile i64, ptr %p, align 8
ret void
}
define void @store_large_offset_no_opt(ptr %p) #0 {
entry:
%0 = getelementptr inbounds i64, ptr %p, i64 100
store volatile i64 1, ptr %0, align 8
%1 = getelementptr inbounds i64, ptr %p, i64 101
store volatile i64 3, ptr %1, align 8
ret void
}
define void @load_large_offset_no_opt(ptr %p) #0 {
entry:
%0 = getelementptr inbounds i64, ptr %p, i64 100
%a = load volatile i64, ptr %0, align 8
%1 = getelementptr inbounds i64, ptr %p, i64 101
%b = load volatile i64, ptr %1, align 8
ret void
}
attributes #0 = { minsize "target-features"="+c" }
...
---
name: store_common_value
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10, $x11, $x12
; CHECK-LABEL: name: store_common_value
; CHECK: liveins: $x10, $x11, $x12
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: $x13 = ADDI $x0, 0
; CHECK-NEXT: SD $x13, killed renamable $x10, 0 :: (store (s64) into %ir.a)
; CHECK-NEXT: SD $x13, killed renamable $x11, 0 :: (store (s64) into %ir.b)
; CHECK-NEXT: SD $x13, killed renamable $x12, 0 :: (store (s64) into %ir.c)
; CHECK-NEXT: PseudoRET
SD $x0, killed renamable $x10, 0 :: (store (s64) into %ir.a)
SD $x0, killed renamable $x11, 0 :: (store (s64) into %ir.b)
SD $x0, killed renamable $x12, 0 :: (store (s64) into %ir.c)
PseudoRET
...
---
name: store_common_ptr
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x16
; CHECK-LABEL: name: store_common_ptr
; CHECK: liveins: $x16
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: renamable $x10 = ADDI $x0, 1
; CHECK-NEXT: $x11 = ADDI $x16, 0
; CHECK-NEXT: SD killed renamable $x10, $x11, 0 :: (volatile store (s64) into %ir.p)
; CHECK-NEXT: renamable $x10 = ADDI $x0, 3
; CHECK-NEXT: SD killed renamable $x10, $x11, 0 :: (volatile store (s64) into %ir.p)
; CHECK-NEXT: renamable $x10 = ADDI $x0, 5
; CHECK-NEXT: SD killed renamable $x10, killed $x11, 0 :: (volatile store (s64) into %ir.p)
; CHECK-NEXT: PseudoRET
renamable $x10 = ADDI $x0, 1
SD killed renamable $x10, renamable $x16, 0 :: (volatile store (s64) into %ir.p)
renamable $x10 = ADDI $x0, 3
SD killed renamable $x10, renamable $x16, 0 :: (volatile store (s64) into %ir.p)
renamable $x10 = ADDI $x0, 5
SD killed renamable $x10, killed renamable $x16, 0 :: (volatile store (s64) into %ir.p)
PseudoRET
...
---
name: store_common_ptr_self
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x16
; CHECK-LABEL: name: store_common_ptr_self
; CHECK: liveins: $x16
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: renamable $x10 = ADDI $x0, 1
; CHECK-NEXT: $x11 = ADDI $x16, 0
; CHECK-NEXT: SD killed renamable $x10, $x11, 0 :: (volatile store (s64) into %ir.p)
; CHECK-NEXT: renamable $x10 = ADDI $x0, 3
; CHECK-NEXT: SD killed renamable $x10, $x11, 0 :: (volatile store (s64) into %ir.p)
; CHECK-NEXT: SD killed $x11, $x11, 0 :: (volatile store (s64) into %ir.q)
; CHECK-NEXT: PseudoRET
renamable $x10 = ADDI $x0, 1
SD killed renamable $x10, renamable $x16, 0 :: (volatile store (s64) into %ir.p)
renamable $x10 = ADDI $x0, 3
SD killed renamable $x10, renamable $x16, 0 :: (volatile store (s64) into %ir.p)
SD killed renamable $x16, renamable $x16, 0 :: (volatile store (s64) into %ir.q)
PseudoRET
...
---
name: load_common_ptr
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x16
; CHECK-LABEL: name: load_common_ptr
; CHECK: liveins: $x16
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: $x11 = ADDI $x16, 0
; CHECK-NEXT: dead renamable $x10 = LD $x11, 0 :: (volatile load (s64) from %ir.p)
; CHECK-NEXT: dead renamable $x10 = LD $x11, 0 :: (volatile load (s64) from %ir.p)
; CHECK-NEXT: dead renamable $x10 = LD killed $x11, 0 :: (volatile load (s64) from %ir.p)
; CHECK-NEXT: PseudoRET
dead renamable $x10 = LD renamable $x16, 0 :: (volatile load (s64) from %ir.p)
dead renamable $x10 = LD renamable $x16, 0 :: (volatile load (s64) from %ir.p)
dead renamable $x10 = LD killed renamable $x16, 0 :: (volatile load (s64) from %ir.p)
PseudoRET
...
---
name: store_large_offset
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10
; CHECK-LABEL: name: store_large_offset
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: renamable $x11 = ADDI $x0, 1
; CHECK-NEXT: $x12 = ADDI $x10, 768
; CHECK-NEXT: SD killed renamable $x11, $x12, 32 :: (volatile store (s64) into %ir.0)
; CHECK-NEXT: renamable $x11 = ADDI $x0, 3
; CHECK-NEXT: SD killed renamable $x11, $x12, 40 :: (volatile store (s64) into %ir.1)
; CHECK-NEXT: renamable $x11 = ADDI $x0, 5
; CHECK-NEXT: SD killed renamable $x11, $x12, 48 :: (volatile store (s64) into %ir.2)
; CHECK-NEXT: renamable $x11 = ADDI $x0, 7
; CHECK-NEXT: SD killed renamable $x11, killed $x12, 56 :: (volatile store (s64) into %ir.3)
; CHECK-NEXT: PseudoRET
renamable $x11 = ADDI $x0, 1
SD killed renamable $x11, renamable $x10, 800 :: (volatile store (s64) into %ir.0)
renamable $x11 = ADDI $x0, 3
SD killed renamable $x11, renamable $x10, 808 :: (volatile store (s64) into %ir.1)
renamable $x11 = ADDI $x0, 5
SD killed renamable $x11, renamable $x10, 816 :: (volatile store (s64) into %ir.2)
renamable $x11 = ADDI $x0, 7
SD killed renamable $x11, killed renamable $x10, 824 :: (volatile store (s64) into %ir.3)
PseudoRET
...
---
name: load_large_offset
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10
; CHECK-LABEL: name: load_large_offset
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: $x12 = ADDI $x10, 768
; CHECK-NEXT: dead renamable $x11 = LD $x12, 32 :: (volatile load (s64) from %ir.0)
; CHECK-NEXT: dead renamable $x11 = LD $x12, 40 :: (volatile load (s64) from %ir.1)
; CHECK-NEXT: dead renamable $x11 = LD $x12, 48 :: (volatile load (s64) from %ir.2)
; CHECK-NEXT: dead renamable $x10 = LD killed $x12, 56 :: (volatile load (s64) from %ir.3)
; CHECK-NEXT: PseudoRET
dead renamable $x11 = LD renamable $x10, 800 :: (volatile load (s64) from %ir.0)
dead renamable $x11 = LD renamable $x10, 808 :: (volatile load (s64) from %ir.1)
dead renamable $x11 = LD renamable $x10, 816 :: (volatile load (s64) from %ir.2)
dead renamable $x10 = LD killed renamable $x10, 824 :: (volatile load (s64) from %ir.3)
PseudoRET
...
---
name: store_common_value_no_opt
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10
; CHECK-LABEL: name: store_common_value_no_opt
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: SD $x0, killed renamable $x10, 0 :: (store (s64) into %ir.a)
; CHECK-NEXT: PseudoRET
SD $x0, killed renamable $x10, 0 :: (store (s64) into %ir.a)
PseudoRET
...
---
name: store_common_ptr_no_opt
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x16
; CHECK-LABEL: name: store_common_ptr_no_opt
; CHECK: liveins: $x16
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: renamable $x10 = ADDI $x0, 1
; CHECK-NEXT: SD killed renamable $x10, killed renamable $x16, 0 :: (volatile store (s64) into %ir.p)
; CHECK-NEXT: PseudoRET
renamable $x10 = ADDI $x0, 1
SD killed renamable $x10, killed renamable $x16, 0 :: (volatile store (s64) into %ir.p)
PseudoRET
...
---
name: load_common_ptr_no_opt
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x16
; CHECK-LABEL: name: load_common_ptr_no_opt
; CHECK: liveins: $x16
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: dead renamable $x10 = LD killed renamable $x16, 0 :: (volatile load (s64) from %ir.p)
; CHECK-NEXT: PseudoRET
dead renamable $x10 = LD killed renamable $x16, 0 :: (volatile load (s64) from %ir.p)
PseudoRET
...
---
name: store_large_offset_no_opt
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10
; CHECK-LABEL: name: store_large_offset_no_opt
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: renamable $x11 = ADDI $x0, 1
; CHECK-NEXT: SD killed renamable $x11, renamable $x10, 800 :: (volatile store (s64) into %ir.0)
; CHECK-NEXT: renamable $x11 = ADDI $x0, 3
; CHECK-NEXT: SD killed renamable $x11, killed renamable $x10, 808 :: (volatile store (s64) into %ir.1)
; CHECK-NEXT: PseudoRET
renamable $x11 = ADDI $x0, 1
SD killed renamable $x11, renamable $x10, 800 :: (volatile store (s64) into %ir.0)
renamable $x11 = ADDI $x0, 3
SD killed renamable $x11, killed renamable $x10, 808 :: (volatile store (s64) into %ir.1)
PseudoRET
...
---
name: load_large_offset_no_opt
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x10
; CHECK-LABEL: name: load_large_offset_no_opt
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: dead renamable $x11 = LD renamable $x10, 800 :: (volatile load (s64) from %ir.0)
; CHECK-NEXT: dead renamable $x10 = LD killed renamable $x10, 808 :: (volatile load (s64) from %ir.1)
; CHECK-NEXT: PseudoRET
dead renamable $x11 = LD renamable $x10, 800 :: (volatile load (s64) from %ir.0)
dead renamable $x10 = LD killed renamable $x10, 808 :: (volatile load (s64) from %ir.1)
PseudoRET
...