119 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -verify-machineinstrs -mtriple=aarch64-- -O1 -fast-isel=0 -global-isel=false %s -o - | FileCheck %s -check-prefix=NOLSE3; RUN: llc -verify-machineinstrs -mtriple=aarch64-- -mattr=+lse -O1 -fast-isel=0 -global-isel=false %s -o - | FileCheck %s -check-prefix=LSE4 5define half @test_rmw_xchg_f16(ptr %dst, half %new) {6; NOLSE-LABEL: test_rmw_xchg_f16:7; NOLSE: // %bb.0:8; NOLSE-NEXT: // kill: def $h0 killed $h0 def $s09; NOLSE-NEXT: fmov w9, s010; NOLSE-NEXT: .LBB0_1: // %atomicrmw.start11; NOLSE-NEXT: // =>This Inner Loop Header: Depth=112; NOLSE-NEXT: ldaxrh w8, [x0]13; NOLSE-NEXT: stlxrh w10, w9, [x0]14; NOLSE-NEXT: cbnz w10, .LBB0_115; NOLSE-NEXT: // %bb.2: // %atomicrmw.end16; NOLSE-NEXT: fmov s0, w817; NOLSE-NEXT: // kill: def $h0 killed $h0 killed $s018; NOLSE-NEXT: ret19;20; LSE-LABEL: test_rmw_xchg_f16:21; LSE: // %bb.0:22; LSE-NEXT: // kill: def $h0 killed $h0 def $s023; LSE-NEXT: fmov w8, s024; LSE-NEXT: swpalh w8, w8, [x0]25; LSE-NEXT: fmov s0, w826; LSE-NEXT: // kill: def $h0 killed $h0 killed $s027; LSE-NEXT: ret28 %res = atomicrmw xchg ptr %dst, half %new seq_cst29 ret half %res30}31 32define float @test_rmw_xchg_f32(ptr %dst, float %new) {33; NOLSE-LABEL: test_rmw_xchg_f32:34; NOLSE: // %bb.0:35; NOLSE-NEXT: fmov w9, s036; NOLSE-NEXT: .LBB1_1: // %atomicrmw.start37; NOLSE-NEXT: // =>This Inner Loop Header: Depth=138; NOLSE-NEXT: ldaxr w8, [x0]39; NOLSE-NEXT: stlxr w10, w9, [x0]40; NOLSE-NEXT: cbnz w10, .LBB1_141; NOLSE-NEXT: // %bb.2: // %atomicrmw.end42; NOLSE-NEXT: fmov s0, w843; NOLSE-NEXT: ret44;45; LSE-LABEL: test_rmw_xchg_f32:46; LSE: // %bb.0:47; LSE-NEXT: fmov w8, s048; LSE-NEXT: swpal w8, w8, [x0]49; LSE-NEXT: fmov s0, w850; LSE-NEXT: ret51 %res = atomicrmw xchg ptr %dst, float %new seq_cst52 ret float %res53}54 55define double @test_rmw_xchg_f64(ptr %dst, double %new) {56; NOLSE-LABEL: test_rmw_xchg_f64:57; NOLSE: // %bb.0:58; NOLSE-NEXT: fmov x8, d059; NOLSE-NEXT: .LBB2_1: // %atomicrmw.start60; NOLSE-NEXT: // =>This Inner Loop Header: Depth=161; NOLSE-NEXT: ldaxr x9, [x0]62; NOLSE-NEXT: stlxr w10, x8, [x0]63; NOLSE-NEXT: cbnz w10, .LBB2_164; NOLSE-NEXT: // %bb.2: // %atomicrmw.end65; NOLSE-NEXT: fmov d0, x966; NOLSE-NEXT: ret67;68; LSE-LABEL: test_rmw_xchg_f64:69; LSE: // %bb.0:70; LSE-NEXT: fmov x8, d071; LSE-NEXT: swpal x8, x8, [x0]72; LSE-NEXT: fmov d0, x873; LSE-NEXT: ret74 %res = atomicrmw xchg ptr %dst, double %new seq_cst75 ret double %res76}77 78define fp128 @test_rmw_xchg_f128(ptr %dst, fp128 %new) {79; NOLSE-LABEL: test_rmw_xchg_f128:80; NOLSE: // %bb.0:81; NOLSE-NEXT: sub sp, sp, #3282; NOLSE-NEXT: .cfi_def_cfa_offset 3283; NOLSE-NEXT: str q0, [sp, #16]84; NOLSE-NEXT: ldp x9, x8, [sp, #16]85; NOLSE-NEXT: .LBB3_1: // %atomicrmw.start86; NOLSE-NEXT: // =>This Inner Loop Header: Depth=187; NOLSE-NEXT: ldaxp x11, x10, [x0]88; NOLSE-NEXT: stlxp w12, x9, x8, [x0]89; NOLSE-NEXT: cbnz w12, .LBB3_190; NOLSE-NEXT: // %bb.2: // %atomicrmw.end91; NOLSE-NEXT: stp x11, x10, [sp]92; NOLSE-NEXT: ldr q0, [sp], #3293; NOLSE-NEXT: ret94;95; LSE-LABEL: test_rmw_xchg_f128:96; LSE: // %bb.0:97; LSE-NEXT: sub sp, sp, #3298; LSE-NEXT: .cfi_def_cfa_offset 3299; LSE-NEXT: str q0, [sp, #16]100; LSE-NEXT: ldp x2, x3, [sp, #16]101; LSE-NEXT: ldp x4, x5, [x0]102; LSE-NEXT: .LBB3_1: // %atomicrmw.start103; LSE-NEXT: // =>This Inner Loop Header: Depth=1104; LSE-NEXT: mov x7, x5105; LSE-NEXT: mov x6, x4106; LSE-NEXT: mov x5, x7107; LSE-NEXT: mov x4, x6108; LSE-NEXT: caspal x4, x5, x2, x3, [x0]109; LSE-NEXT: cmp x5, x7110; LSE-NEXT: ccmp x4, x6, #0, eq111; LSE-NEXT: b.ne .LBB3_1112; LSE-NEXT: // %bb.2: // %atomicrmw.end113; LSE-NEXT: stp x4, x5, [sp]114; LSE-NEXT: ldr q0, [sp], #32115; LSE-NEXT: ret116 %res = atomicrmw xchg ptr %dst, fp128 %new seq_cst117 ret fp128 %res118}119