brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · d0055d7 Raw
79 lines · plain
1; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-linux-gnu | FileCheck %s2 3declare i32 @bar()4declare i32 @baz()5 6; Check that the spill of the zero value gets stored directly instead7; of being copied from wzr and then stored.8define i32 @test_zr_spill_fold1(i1 %c) {9; CHECK-LABEL: test_zr_spill_fold1:10entry:11  br i1 %c, label %if.else, label %if.then12 13if.else:14; CHECK: bl bar15; CHECK-NEXT: str w0, [sp, #[[SLOT:[0-9]+]]]16  %call1 = tail call i32 @bar()17  br label %if.end18 19if.then:20; CHECK: bl baz21; CHECK-NEXT: str wzr, [sp, #[[SLOT]]]22  %call2 = tail call i32 @baz()23  br label %if.end24 25if.end:26  %x.0 = phi i32 [ 0, %if.then ], [ %call1, %if.else ]27  call void asm sideeffect "", "~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{fp},~{lr},~{sp}"() nounwind28  ret i32 %x.029}30 31; Similar to test_zr_spill_fold1, but with mis-matched register32; class between %x.0 and the 0 from %if.then.33define i32 @test_zr_spill_fold2(i1 %c) {34; CHECK-LABEL: test_zr_spill_fold2:35entry:36  br i1 %c, label %if.else, label %if.then37 38if.else:39; CHECK: bl bar40; CHECK-NEXT: str w0, [sp, #[[SLOT:[0-9]+]]]41  %call1 = tail call i32 @bar()42  br label %if.end43 44if.then:45; CHECK: bl baz46; CHECK-NEXT: str wzr, [sp, #[[SLOT]]]47  %call2 = tail call i32 @baz()48  br label %if.end49 50if.end:51  %x.0 = phi i32 [ 0, %if.then ], [ %call1, %if.else ]52  call void asm sideeffect "", "~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{fp},~{lr},~{sp}"() nounwind53  %x.1 = add i32 %x.0, 154  ret i32 %x.155}56 57; Similar to test_zr_spill_fold1, but with a cross register-class copy feeding a spill store.58define float @test_cross_spill_fold(i32 %v) {59; CHECK-LABEL: test_cross_spill_fold:60entry:61; CHECK: str w0, [sp, #[[SLOT:[0-9]+]]]62  %v.f = bitcast i32 %v to float63  call void asm sideeffect "", "~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{fp},~{lr},~{sp},~{s0},~{s1},~{s2},~{s3},~{s4},~{s5},~{s6},~{s7},~{s8},~{s9},~{s10},~{s11},~{s12},~{s13},~{s14},~{s15},~{s16},~{s17},~{s18},~{s19},~{s20},~{s21},~{s22},~{s23},~{s24},~{s25},~{s26},~{s27},~{s28},~{s29},~{s30},~{s31}"() nounwind64; CHECK: ldr s0, [sp, #[[SLOT]]]65  ret float %v.f66}67 68; Similar to test_cross_spill_fold, but with a cross register-class copy fed by a refill load.69define float @test_cross_spill_fold2(i32 %v) {70; CHECK-LABEL: test_cross_spill_fold2:71entry:72; CHECK: str w0, [sp, #[[SLOT:[0-9]+]]]73  call void asm sideeffect "", "~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{fp},~{lr},~{sp},~{s0},~{s1},~{s2},~{s3},~{s4},~{s5},~{s6},~{s7},~{s8},~{s9},~{s10},~{s11},~{s12},~{s13},~{s14},~{s15},~{s16},~{s17},~{s18},~{s19},~{s20},~{s21},~{s22},~{s23},~{s24},~{s25},~{s26},~{s27},~{s28},~{s29},~{s30},~{s31}"() nounwind74; CHECK: ldr s0, [sp, #[[SLOT]]]75  %v.f = bitcast i32 %v to float76  ret float %v.f77}78 79