brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · ad2dff1 Raw
158 lines · plain
1; RUN: llc -mtriple=armv6m-linux-gnueabi -verify-machineinstrs -o - %s -disable-constant-hoisting | FileCheck %s2 3%struct_type = type { [10000 x i32], i32, i32 }4 5define void @test1(ptr %s, i32 %n) {6; CHECK-LABEL: test17entry:8  %struct = load ptr, ptr %s9  br label %while_cond10 11while_cond:12  %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]13  %gep0 = getelementptr %struct_type, ptr %struct, i64 0, i32 114  %gep1 = getelementptr %struct_type, ptr %struct, i64 0, i32 215  %cmp = icmp slt i32 %phi, %n16  br i1 %cmp, label %while_body, label %while_end17 18while_body:19; CHECK:      str      r{{[0-9]+}}, [r{{[0-9]+}}]20; CHECK-NEXT: str      r{{[0-9]+}}, [r{{[0-9]+}}, #4]21  %i = add i32 %phi, 122  store i32 %i, ptr %gep023  store i32 %phi, ptr %gep124  br label %while_cond25 26while_end:27  ret void28; CHECK: .LCPI0_0:29; CHECK-NEXT: .long   4000030; CHECK-NOT: LCPI031}32 33define void @test2(ptr %struct, i32 %n) {34; CHECK-LABEL: test235entry:36  %cmp = icmp eq ptr %struct, null37  br i1 %cmp, label %while_end, label %while_cond38 39while_cond:40  %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]41  %gep0 = getelementptr %struct_type, ptr %struct, i64 0, i32 142  %gep1 = getelementptr %struct_type, ptr %struct, i64 0, i32 243  %cmp1 = icmp slt i32 %phi, %n44  br i1 %cmp1, label %while_body, label %while_end45 46while_body:47; CHECK:      str      r{{[0-9]+}}, [r{{[0-9]+}}]48; CHECK-NEXT: str      r{{[0-9]+}}, [r{{[0-9]+}}, #4]49  %i = add i32 %phi, 150  store i32 %i, ptr %gep051  store i32 %phi, ptr %gep152  br label %while_cond53 54while_end:55  ret void56; CHECK: .LCPI1_0:57; CHECK-NEXT: .long   4000058; CHECK-NOT: LCPI159}60 61define void @test3(ptr %s1, ptr %s2, i1 %cond, i32 %n) {62; CHECK-LABEL: test363entry:64  br i1 %cond, label %if_true, label %if_end65 66if_true:67  br label %if_end68 69if_end:70  %struct = phi ptr [ %s1, %entry ], [ %s2, %if_true ]71  %cmp = icmp eq ptr %struct, null72  br i1 %cmp, label %while_end, label %while_cond73 74while_cond:75  %phi = phi i32 [ 0, %if_end ], [ %i, %while_body ]76  %gep0 = getelementptr %struct_type, ptr %struct, i64 0, i32 177  %gep1 = getelementptr %struct_type, ptr %struct, i64 0, i32 278  %cmp1 = icmp slt i32 %phi, %n79  br i1 %cmp1, label %while_body, label %while_end80 81while_body:82; CHECK:      str      r{{[0-9]+}}, [r{{[0-9]+}}]83; CHECK-NEXT: str      r{{[0-9]+}}, [r{{[0-9]+}}, #4]84  %i = add i32 %phi, 185  store i32 %i, ptr %gep086  store i32 %phi, ptr %gep187  br label %while_cond88 89while_end:90  ret void91; CHECK: .LCPI2_0:92; CHECK-NEXT: .long   4000093; CHECK-NOT: LCPI294}95 96declare ptr @foo()97 98define void @test4(i32 %n) personality ptr @__FrameHandler {99; CHECK-LABEL: test4100entry:101  %struct = invoke ptr @foo() to label %while_cond unwind label %cleanup102 103while_cond:104  %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]105  %gep0 = getelementptr %struct_type, ptr %struct, i64 0, i32 1106  %gep1 = getelementptr %struct_type, ptr %struct, i64 0, i32 2107  %cmp = icmp slt i32 %phi, %n108  br i1 %cmp, label %while_body, label %while_end109 110while_body:111; CHECK:      str      r{{[0-9]+}}, [r{{[0-9]+}}]112; CHECK-NEXT: str      r{{[0-9]+}}, [r{{[0-9]+}}, #4]113  %i = add i32 %phi, 1114  store i32 %i, ptr %gep0115  store i32 %phi, ptr %gep1116  br label %while_cond117 118while_end:119  ret void120 121cleanup:122  landingpad { ptr, i32 } cleanup123  unreachable124; CHECK: .LCPI3_0:125; CHECK-NEXT: .long   40000126; CHECK-NOT: LCPI3127}128 129declare i32 @__FrameHandler(...)130 131define void @test5(ptr %s, i32 %n) {132; CHECK-LABEL: test5133entry:134  %struct = load ptr, ptr %s135  br label %while_cond136 137while_cond:138  %phi = phi i32 [ 0, %entry ], [ %i, %while_body ]139  %gep0 = getelementptr [65536 x i32], ptr %struct, i64 0, i32 20000140  %gep1 = getelementptr [65536 x i32], ptr %struct, i64 0, i32 20001141  %cmp = icmp slt i32 %phi, %n142  br i1 %cmp, label %while_body, label %while_end143 144while_body:145; CHECK:      str      r{{[0-9]+}}, [r{{[0-9]+}}]146; CHECK-NEXT: str      r{{[0-9]+}}, [r{{[0-9]+}}, #4]147  %i = add i32 %phi, 1148  store i32 %i, ptr %gep0149  store i32 %phi, ptr %gep1150  br label %while_cond151 152while_end:153  ret void154; CHECK: .LCPI4_0:155; CHECK-NEXT: .long   80000156; CHECK-NOT: LCPI4157}158