brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.8 KiB · 2ed05e4 Raw
148 lines · plain
1; RUN: llc < %s --mtriple=wasm32-unknown-unknown -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck -DPTR=32 %s2; RUN: llc < %s --mtriple=wasm64-unknown-unknown -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck -DPTR=64 %s3 4declare void @somefunc(ptr)5 6; CHECK-LABEL: underalign:7; CHECK:      global.get $push[[L1:.+]]=, __stack_pointer{{$}}8; CHECK-NEXT: i[[PTR]].const $push[[L2:.+]]=, 169; CHECK-NEXT: i[[PTR]].sub $push[[L10:.+]]=, $pop[[L1]], $pop[[L2]]10; CHECK-NEXT: local.tee $push{{.+}}=, [[SP:.+]], $pop[[L10]]11 12; CHECK:      local.get $push[[L3:.+]]=, [[SP]]{{$}}13; CHECK:      i[[PTR]].add $push[[underaligned:.+]]=, $pop[[L3]], $pop{{.+}}14; CHECK-NEXT: call somefunc, $pop[[underaligned]]15 16; CHECK:      local.get $push[[M4:.+]]=, [[SP]]{{$}}17; CHECK:      i[[PTR]].add $push[[L5:.+]]=, $pop[[M4]], $pop{{.+}}18; CHECK-NEXT: global.set __stack_pointer, $pop[[L5]]19define void @underalign() {20entry:21  %underaligned = alloca i32, align 822  call void @somefunc(ptr %underaligned)23  ret void24}25 26; CHECK-LABEL: overalign:27; CHECK:      global.get $push[[L10:.+]]=, __stack_pointer{{$}}28; CHECK-NEXT: local.tee $push[[L9:.+]]=, [[BP:.+]], $pop[[L10]]29; CHECK-NEXT: i[[PTR]].const $push[[L2:.+]]=, 3230; CHECK-NEXT: i[[PTR]].sub $push[[L8:.+]]=, $pop[[L9]], $pop[[L2]]31; CHECK-NEXT: i[[PTR]].const $push[[L3:.+]]=, -3232; CHECK-NEXT: i[[PTR]].and $push[[L7:.+]]=, $pop[[L8]], $pop[[L3]]33; CHECK-NEXT: local.tee $push{{.+}}=, [[SP:.+]], $pop[[L7]]34 35; CHECK:      local.get $push[[M5:.+]]=, [[SP]]{{$}}36; CHECK:      call somefunc, $pop[[M5]]{{$}}37 38; CHECK:      local.get $push[[M6:.+]]=, [[BP]]{{$}}39; CHECK-NEXT: global.set __stack_pointer, $pop[[M6]]40define void @overalign() {41entry:42  %overaligned = alloca i32, align 3243  call void @somefunc(ptr %overaligned)44  ret void45}46 47; CHECK-LABEL: over_and_normal_align:48; CHECK:      global.get $push[[L14:.+]]=, __stack_pointer{{$}}49; CHECK-NEXT: local.tee $push[[L13:.+]]=, [[BP:.+]], $pop[[L14]]50; CHECK:      i[[PTR]].sub $push[[L12:.+]]=, $pop[[L13]], $pop{{.+}}51; CHECK:      i[[PTR]].and $push[[L11:.+]]=, $pop[[L12]], $pop{{.+}}52; CHECK-NEXT: local.tee $push{{.+}}=, [[SP:.+]], $pop[[L11]]53 54; CHECK:      local.get  $push[[M6:.+]]=, [[SP]]{{$}}55; CHECK:      i[[PTR]].add $push[[L6:.+]]=, $pop[[M6]], $pop{{.+}}56; CHECK-NEXT: call somefunc, $pop[[L6]]57; CHECK:      local.get $push[[M7:.+]]=, [[SP]]{{$}}58; CHECK:      i[[PTR]].add $push[[L8:.+]]=, $pop[[M7]], $pop{{.+}}59; CHECK-NEXT: call somefunc, $pop[[L8]]60 61; CHECK:      local.get $push[[L6:.+]]=, [[BP]]{{$}}62; CHECK-NEXT: global.set __stack_pointer, $pop[[L6]]63define void @over_and_normal_align() {64entry:65  %over = alloca i32, align 3266  %normal = alloca i3267  call void @somefunc(ptr %over)68  call void @somefunc(ptr %normal)69  ret void70}71 72; CHECK-LABEL: dynamic_overalign:73; CHECK:      global.get $push[[L18:.+]]=, __stack_pointer{{$}}74; CHECK-NEXT: local.tee $push[[L17:.+]]=, [[SP:.+]], $pop[[L18]]75; CHECK-NEXT: local.set [[BP:.+]], $pop[[L17]]76; CHECK:      local.tee $push{{.+}}=, [[SP_2:.+]], $pop{{.+}}77 78; CHECK:      local.get $push[[M8:.+]]=, [[SP_2]]{{$}}79; CHECK:      call somefunc, $pop[[M8]]80 81; CHECK:      local.get $push[[M9:.+]]=, [[BP]]{{$}}82; CHECK-NEXT: global.set __stack_pointer, $pop[[M9]]83define void @dynamic_overalign(i32 %num) {84entry:85  %dynamic = alloca i32, i32 %num, align 3286  call void @somefunc(ptr %dynamic)87  ret void88}89 90; CHECK-LABEL: overalign_and_dynamic:91; CHECK:      global.get $push[[L21:.+]]=, __stack_pointer{{$}}92; CHECK-NEXT: local.tee $push[[L20:.+]]=, [[BP:.+]], $pop[[L21]]93; CHECK:      i[[PTR]].sub $push[[L19:.+]]=, $pop[[L20]], $pop{{.+}}94; CHECK:      i[[PTR]].and $push[[L18:.+]]=, $pop[[L19]], $pop{{.+}}95; CHECK:      local.tee $push{{.+}}=, [[FP:.+]], $pop[[L18]]96; CHECK:      local.get $push[[M10:.+]]=, [[FP]]{{$}}97; CHECK:      i[[PTR]].sub $push[[L16:.+]]=, $pop[[M10]], $pop{{.+}}98; CHECK-NEXT: local.tee $push{{.+}}=, [[SP:.+]], $pop[[L16]]99 100; CHECK:      local.get $push[[over:.+]]=, [[FP]]101; CHECK-NEXT: call somefunc, $pop[[over]]102; CHECK:      local.get $push[[another:.+]]=, [[SP]]103; CHECK-NEXT: call somefunc, $pop[[another]]104 105; CHECK:      local.get  $push[[M11:.+]]=, [[BP]]{{$}}106; CHECK-NEXT: global.set __stack_pointer, $pop[[M11]]107define void @overalign_and_dynamic(i32 %num) {108entry:109  %over = alloca i32, align 32110  %dynamic = alloca i32, i32 %num111  call void @somefunc(ptr %over)112  call void @somefunc(ptr %dynamic)113  ret void114}115 116; CHECK-LABEL: overalign_static_and_dynamic:117; CHECK:      global.get $push[[L26:.+]]=, __stack_pointer{{$}}118; CHECK-NEXT: local.tee $push[[L25:.+]]=, [[BP:.+]], $pop[[L26]]119; CHECK:      i[[PTR]].sub $push[[L24:.+]]=, $pop[[L25]], $pop{{.+}}120; CHECK:      i[[PTR]].and $push[[L23:.+]]=, $pop[[L24]], $pop{{.+}}121; CHECK:      local.tee $push{{.+}}=, [[FP:.+]], $pop[[L23]]122; CHECK:      local.get $push[[M12:.+]]=, [[FP]]{{$}}123; CHECK:      i[[PTR]].sub $push[[L21:.+]]=, $pop[[M12]], $pop{{.+}}124; CHECK-NEXT: local.tee $push{{.+}}=, [[SP:.+]], $pop[[L21]]125 126; CHECK:      local.get $push[[L19:.+]]=, [[FP]]127; CHECK:      local.tee $push[[L18:.+]]=, [[FP_2:.+]], $pop[[L19]]128; CHECK:      i[[PTR]].add $push[[over:.+]]=, $pop[[L18]], $pop{{.+}}129; CHECK-NEXT: call somefunc, $pop[[over]]130; CHECK:      local.get $push[[M12:.+]]=, [[SP]]131; CHECK:      call somefunc, $pop[[M12]]132; CHECK:      local.get $push[[M13:.+]]=, [[FP_2]]133; CHECK:      i[[PTR]].add $push[[static:.+]]=, $pop[[M13]], $pop{{.+}}134; CHECK-NEXT: call somefunc, $pop[[static]]135 136; CHECK:      local.get  $push[[M14:.+]]=, [[BP]]{{$}}137; CHECK-NEXT: global.set __stack_pointer, $pop[[M14]]138define void @overalign_static_and_dynamic(i32 %num) {139entry:140  %over = alloca i32, align 32141  %dynamic = alloca i32, i32 %num142  %static = alloca i32143  call void @somefunc(ptr %over)144  call void @somefunc(ptr %dynamic)145  call void @somefunc(ptr %static)146  ret void147}148