llvm/llvm/test/CodeGen/RISCV/make-compressible-zfinx.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -o - %s -mtriple=riscv32 -mattr=+c,+zfinx -simplify-mir \
# RUN:   -run-pass=riscv-make-compressible | FileCheck --check-prefixes=CHECK %s
# RUN: llc -o - %s -mtriple=riscv64 -mattr=+c,+zfinx -simplify-mir \
# RUN:   -run-pass=riscv-make-compressible | FileCheck --check-prefixes=CHECK %s

--- |

  define void @store_common_value_float(ptr %a, ptr %b, ptr %c, float %d, float %e, float %f, float %g, float %h, float %i, float %j) #0 {
  entry:
    store float %j, ptr %a, align 4
    store float %j, ptr %b, align 4
    store float %j, ptr %c, align 4
    ret void
  }

  define void @store_common_ptr_float(float %a, float %b, float %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h, i32 %i, ptr %p) #0 {
  entry:
    store volatile float %a, ptr %p, align 4
    store volatile float %b, ptr %p, align 4
    store volatile float %c, ptr %p, align 4
    ret void
  }

  define void @load_common_ptr_float(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, ptr %g) #0 {
  entry:
    %0 = load float, ptr %g, align 4
    %arrayidx1 = getelementptr inbounds float, ptr %g, i32 1
    %1 = load float, ptr %arrayidx1, align 4
    %arrayidx2 = getelementptr inbounds float, ptr %g, i32 2
    %2 = load float, ptr %arrayidx2, align 4
    tail call void @load_common_ptr_float_1(float %0, float %1, float %2)
    ret void
  }

  declare void @load_common_ptr_float_1(float, float, float) #0

  define void @store_large_offset_float(ptr %p, float %a, float %b, float %c, float %d) #0 {
  entry:
    %0 = getelementptr inbounds float, ptr %p, i32 100
    store volatile float %a, ptr %0, align 4
    %1 = getelementptr inbounds float, ptr %p, i32 101
    store volatile float %b, ptr %1, align 4
    %2 = getelementptr inbounds float, ptr %p, i32 102
    store volatile float %c, ptr %2, align 4
    %3 = getelementptr inbounds float, ptr %p, i32 103
    store volatile float %d, ptr %3, align 4
    ret void
  }

  define void @load_large_offset_float(ptr %p) #0 {
  entry:
    %arrayidx = getelementptr inbounds float, ptr %p, i32 100
    %0 = load float, ptr %arrayidx, align 4
    %arrayidx1 = getelementptr inbounds float, ptr %p, i32 101
    %1 = load float, ptr %arrayidx1, align 4
    %arrayidx2 = getelementptr inbounds float, ptr %p, i32 102
    %2 = load float, ptr %arrayidx2, align 4
    tail call void @load_large_offset_float_1(float %0, float %1, float %2)
    ret void
  }

  declare void @load_large_offset_float_1(float, float, float) #0

  define void @store_common_value_float_no_opt(ptr %a, float %b, float %c, float %d, float %e, float %f, float %g, float %h) #0 {
  entry:
    store float %h, ptr %a, align 4
    ret void
  }

  define void @store_common_ptr_float_no_opt(float %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, ptr %p) #0 {
  entry:
    store volatile float %a, ptr %p, align 4
    ret void
  }

  define float @load_common_ptr_float_no_opt(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, ptr %g) #0 {
  entry:
    %0 = load float, ptr %g, align 4
    ret float %0
  }

  define void @store_large_offset_float_no_opt(ptr %p, float %a, float %b) #0 {
  entry:
    %0 = getelementptr inbounds float, ptr %p, i32 100
    store volatile float %a, ptr %0, align 4
    %1 = getelementptr inbounds float, ptr %p, i32 101
    store volatile float %b, ptr %1, align 4
    ret void
  }

  define { float, float } @load_large_offset_float_no_opt(ptr %p) #0 {
  entry:
    %arrayidx = getelementptr inbounds float, ptr %p, i32 100
    %0 = load float, ptr %arrayidx, align 4
    %arrayidx1 = getelementptr inbounds float, ptr %p, i32 101
    %1 = load float, ptr %arrayidx1, align 4
    %2 = insertvalue { float, float } undef, float %0, 0
    %3 = insertvalue { float, float } %2, float %1, 1
    ret { float, float } %3
  }

  attributes #0 = { minsize }

...
---
name:            store_common_value_float
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x10, $x11, $x12

    ; CHECK-LABEL: name: store_common_value_float
    ; CHECK: liveins: $x10, $x11, $x12
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: $x13_w = PseudoMV_FPR32INX $x0_w
    ; CHECK-NEXT: SW_INX $x13_w, killed renamable $x10, 0 :: (store (s32) into %ir.a)
    ; CHECK-NEXT: SW_INX $x13_w, killed renamable $x11, 0 :: (store (s32) into %ir.b)
    ; CHECK-NEXT: SW_INX killed $x13_w, killed renamable $x12, 0 :: (store (s32) into %ir.c)
    ; CHECK-NEXT: PseudoRET
    SW_INX $x0_w, killed renamable $x10, 0 :: (store (s32) into %ir.a)
    SW_INX $x0_w, killed renamable $x11, 0 :: (store (s32) into %ir.b)
    SW_INX killed $x0_w, killed renamable $x12, 0 :: (store (s32) into %ir.c)
    PseudoRET

...
---
name:            store_common_ptr_float
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x10_w, $x11_w, $x12_w, $x16

    ; CHECK-LABEL: name: store_common_ptr_float
    ; CHECK: liveins: $x10_w, $x11_w, $x12_w, $x16
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: $x13 = ADDI $x16, 0
    ; CHECK-NEXT: SW_INX killed renamable $x10_w, $x13, 0 :: (volatile store (s32) into %ir.p)
    ; CHECK-NEXT: SW_INX killed renamable $x11_w, $x13, 0 :: (volatile store (s32) into %ir.p)
    ; CHECK-NEXT: SW_INX killed renamable $x12_w, killed $x13, 0 :: (volatile store (s32) into %ir.p)
    ; CHECK-NEXT: PseudoRET
    SW_INX killed renamable $x10_w, renamable $x16, 0 :: (volatile store (s32) into %ir.p)
    SW_INX killed renamable $x11_w, renamable $x16, 0 :: (volatile store (s32) into %ir.p)
    SW_INX killed renamable $x12_w, killed renamable $x16, 0 :: (volatile store (s32) into %ir.p)
    PseudoRET

...
---
name:            load_common_ptr_float
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x16

    ; CHECK-LABEL: name: load_common_ptr_float
    ; CHECK: liveins: $x16
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: $x13 = ADDI $x16, 0
    ; CHECK-NEXT: renamable $x10_w = LW_INX $x13, 0 :: (load (s32) from %ir.g)
    ; CHECK-NEXT: renamable $x11_w = LW_INX $x13, 4 :: (load (s32) from %ir.arrayidx1)
    ; CHECK-NEXT: renamable $x12_w = LW_INX killed $x13, 8 :: (load (s32) from %ir.arrayidx2)
    ; CHECK-NEXT: PseudoTAIL target-flags(riscv-call) @load_common_ptr_float_1, implicit $x2, implicit $x10_w, implicit $x11_w, implicit $x12_w
    renamable $x10_w = LW_INX renamable $x16, 0 :: (load (s32) from %ir.g)
    renamable $x11_w = LW_INX renamable $x16, 4 :: (load (s32) from %ir.arrayidx1)
    renamable $x12_w = LW_INX killed renamable $x16, 8 :: (load (s32) from %ir.arrayidx2)
    PseudoTAIL target-flags(riscv-call) @load_common_ptr_float_1, implicit $x2, implicit $x10_w, implicit $x11_w, implicit $x12_w

...
---
name:            store_large_offset_float
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x10, $x11_w, $x11_w, $x12_w, $x13_w

    ; CHECK-LABEL: name: store_large_offset_float
    ; CHECK: liveins: $x10, $x11_w, $x11_w, $x12_w, $x13_w
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: $x14 = ADDI $x10, 384
    ; CHECK-NEXT: SW_INX killed renamable $x10_w, $x14, 16 :: (volatile store (s32) into %ir.0)
    ; CHECK-NEXT: SW_INX killed renamable $x11_w, $x14, 20 :: (volatile store (s32) into %ir.1)
    ; CHECK-NEXT: SW_INX killed renamable $x12_w, $x14, 24 :: (volatile store (s32) into %ir.2)
    ; CHECK-NEXT: SW_INX killed renamable $x13_w, killed $x14, 28 :: (volatile store (s32) into %ir.3)
    ; CHECK-NEXT: PseudoRET
    SW_INX killed renamable $x10_w, renamable $x10, 400 :: (volatile store (s32) into %ir.0)
    SW_INX killed renamable $x11_w, renamable $x10, 404 :: (volatile store (s32) into %ir.1)
    SW_INX killed renamable $x12_w, renamable $x10, 408 :: (volatile store (s32) into %ir.2)
    SW_INX killed renamable $x13_w, killed renamable $x10, 412 :: (volatile store (s32) into %ir.3)
    PseudoRET

...
---
name:            load_large_offset_float
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x10

    ; CHECK-LABEL: name: load_large_offset_float
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: $x14 = ADDI $x10, 384
    ; CHECK-NEXT: renamable $x11_w = LW_INX $x14, 16 :: (load (s32) from %ir.arrayidx)
    ; CHECK-NEXT: renamable $x12_w = LW_INX $x14, 20 :: (load (s32) from %ir.arrayidx1)
    ; CHECK-NEXT: renamable $x13_w = LW_INX killed $x14, 24 :: (load (s32) from %ir.arrayidx2)
    ; CHECK-NEXT: PseudoTAIL target-flags(riscv-call) @load_large_offset_float_1, implicit $x2, implicit $x11_w, implicit $x12_w, implicit $x12_w
    renamable $x11_w = LW_INX renamable $x10, 400 :: (load (s32) from %ir.arrayidx)
    renamable $x12_w = LW_INX renamable $x10, 404 :: (load (s32) from %ir.arrayidx1)
    renamable $x13_w = LW_INX killed renamable $x10, 408 :: (load (s32) from %ir.arrayidx2)
    PseudoTAIL target-flags(riscv-call) @load_large_offset_float_1, implicit $x2, implicit $x11_w, implicit $x12_w, implicit $x12_w

...
---
name:            store_common_value_float_no_opt
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x10, $x16_w

    ; CHECK-LABEL: name: store_common_value_float_no_opt
    ; CHECK: liveins: $x10, $x16_w
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: SW_INX killed renamable $x16_w, killed renamable $x10, 0 :: (store (s32) into %ir.a)
    ; CHECK-NEXT: PseudoRET
    SW_INX killed renamable $x16_w, killed renamable $x10, 0 :: (store (s32) into %ir.a)
    PseudoRET

...
---
name:            store_common_ptr_float_no_opt
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x16, $x10_w

    ; CHECK-LABEL: name: store_common_ptr_float_no_opt
    ; CHECK: liveins: $x16, $x10_w
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: SW_INX killed renamable $x10_w, killed renamable $x16, 0 :: (volatile store (s32) into %ir.p)
    ; CHECK-NEXT: PseudoRET
    SW_INX killed renamable $x10_w, killed renamable $x16, 0 :: (volatile store (s32) into %ir.p)
    PseudoRET

...
---
name:            load_common_ptr_float_no_opt
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x16

    ; CHECK-LABEL: name: load_common_ptr_float_no_opt
    ; CHECK: liveins: $x16
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: renamable $x10_w = LW_INX killed renamable $x16, 0 :: (load (s32) from %ir.g)
    ; CHECK-NEXT: PseudoRET implicit $x10_w
    renamable $x10_w = LW_INX killed renamable $x16, 0 :: (load (s32) from %ir.g)
    PseudoRET implicit $x10_w

...
---
name:            store_large_offset_float_no_opt
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x10, $x11_w, $x12_w

    ; CHECK-LABEL: name: store_large_offset_float_no_opt
    ; CHECK: liveins: $x10, $x11_w, $x12_w
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: SW_INX killed renamable $x11_w, renamable $x10, 400 :: (volatile store (s32) into %ir.0)
    ; CHECK-NEXT: SW_INX killed renamable $x12_w, killed renamable $x10, 404 :: (volatile store (s32) into %ir.1)
    ; CHECK-NEXT: PseudoRET
    SW_INX killed renamable $x11_w, renamable $x10, 400 :: (volatile store (s32) into %ir.0)
    SW_INX killed renamable $x12_w, killed renamable $x10, 404 :: (volatile store (s32) into %ir.1)
    PseudoRET

...
---
name:            load_large_offset_float_no_opt
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $x10

    ; CHECK-LABEL: name: load_large_offset_float_no_opt
    ; CHECK: liveins: $x10
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: renamable $x11_w = LW_INX renamable $x10, 400 :: (load (s32) from %ir.arrayidx)
    ; CHECK-NEXT: renamable $x12_w = LW_INX killed renamable $x10, 404 :: (load (s32) from %ir.arrayidx1)
    ; CHECK-NEXT: PseudoRET implicit $x11_w, implicit $x12_w
    renamable $x11_w = LW_INX renamable $x10, 400 :: (load (s32) from %ir.arrayidx)
    renamable $x12_w = LW_INX killed renamable $x10, 404 :: (load (s32) from %ir.arrayidx1)
    PseudoRET implicit $x11_w, implicit $x12_w

...