llvm/llvm/test/CodeGen/ARM/cmse-cve-2021-35465-return.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
;
; RUN: llc %s -o - -mtriple=thumbv8m.main -verify-machineinstrs \
; RUN:   -mattr=+fp-armv8d16sp,+fix-cmse-cve-2021-35465 -float-abi=hard | \
; RUN:   FileCheck %s --check-prefix=CHECK-8M-FP-CVE-2021-35465

%indirect = type { double, double, double, double, double, double, double, double }

define %indirect @func(ptr %fu, float %a, i32 %b, double %c, i32 %d, float %e, i32 %f, float %g, i32 %h, double %i, double %j, double %k, double %l, float %m, float %n) {
; CHECK-8M-FP-CVE-2021-35465-LABEL: func:
; CHECK-8M-FP-CVE-2021-35465:       @ %bb.0: @ %entry
; CHECK-8M-FP-CVE-2021-35465-NEXT:    push {r7, lr}
; CHECK-8M-FP-CVE-2021-35465-NEXT:    mov lr, r3
; CHECK-8M-FP-CVE-2021-35465-NEXT:    mov r12, r0
; CHECK-8M-FP-CVE-2021-35465-NEXT:    mov r0, r1
; CHECK-8M-FP-CVE-2021-35465-NEXT:    mov r1, r2
; CHECK-8M-FP-CVE-2021-35465-NEXT:    ldr r3, [sp, #8]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    mov r2, lr
; CHECK-8M-FP-CVE-2021-35465-NEXT:    push.w {r4, r5, r6, r7, r8, r9, r10, r11}
; CHECK-8M-FP-CVE-2021-35465-NEXT:    bic r12, r12, #1
; CHECK-8M-FP-CVE-2021-35465-NEXT:    sub sp, #136
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r4, s5
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r11, s0
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r9, r10, d1
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r8, s1
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r7, s4
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r5, r6, d3
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vlstm sp
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov s0, r11
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov d1, r9, r10
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov s1, r8
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov s4, r7
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov d3, r5, r6
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov s5, r4
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vldr d4, [sp, #32]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vldr d5, [sp, #40]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vldr d6, [sp, #48]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vldr s14, [sp, #56]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    ldr r4, [sp, #64]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    bic r4, r4, #159
; CHECK-8M-FP-CVE-2021-35465-NEXT:    bic r4, r4, #4026531840
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmsr fpscr, r4
; CHECK-8M-FP-CVE-2021-35465-NEXT:    msr apsr_nzcvq, r12
; CHECK-8M-FP-CVE-2021-35465-NEXT:    blxns r12
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r9, r10, d0
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vstr d3, [sp, #24]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r7, r8, d1
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vstr d4, [sp, #32]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov r5, r6, d2
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vstr d5, [sp, #40]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vstr d6, [sp, #48]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vstr d7, [sp, #56]
; CHECK-8M-FP-CVE-2021-35465-NEXT:    mrs r11, control
; CHECK-8M-FP-CVE-2021-35465-NEXT:    tst.w r11, #8
; CHECK-8M-FP-CVE-2021-35465-NEXT:    it ne
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmovne.f32 s0, s0
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vlldm sp
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov d0, r9, r10
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov d1, r7, r8
; CHECK-8M-FP-CVE-2021-35465-NEXT:    vmov d2, r5, r6
; CHECK-8M-FP-CVE-2021-35465-NEXT:    add sp, #136
; CHECK-8M-FP-CVE-2021-35465-NEXT:    pop.w {r4, r5, r6, r7, r8, r9, r10, r11}
; CHECK-8M-FP-CVE-2021-35465-NEXT:    pop {r7, pc}
entry:
  %res = call %indirect %fu(float %a, i32 %b, double %c, i32 %d, float %e, i32 %f, float %g, i32 %h, double %i, double %j, double %k, double %l, float %m, float %n) #0
  ret %indirect %res
}

attributes #0 = { "cmse_nonsecure_call" }