brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.0 KiB · c4a8955 Raw
165 lines · plain
1; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s2; RUN: llc -verify-machineinstrs -mtriple=powerpc64-ibm-aix-xcoff < %s | FileCheck %s --check-prefix=AIX643; RUN: llc -verify-machineinstrs -mtriple=powerpc-ibm-aix-xcoff < %s | FileCheck %s --check-prefix=AIX324 5define signext i32 @test1(i32 signext %i, ptr nocapture %Func, ptr nocapture %Func2) {6entry:7; CHECK-LABEL: test1:8; CHECK:    std 2, 24(1)9; CHECK-NOT:    std 2, 24(1)10 11; AIX64-LABEL: test1:12; AIX64: std 2, 40(1)13; AIX64-NOT: std 2, 40(1)14 15; AIX32-LABEL: test1:16; AIX32: stw 2, 20(1)17; AIX32-NOT: std 2, 20(1)18  %call = tail call signext i32 %Func(i32 signext %i)19  %call1 = tail call signext i32 %Func2(i32 signext %i)20  %add2 = add nsw i32 %call1, %call21  ret i32 %add222}23 24define signext i32 @test2(i32 signext %i, i32 signext %j, ptr nocapture %Func, ptr nocapture %Func2) {25entry:26; CHECK-LABEL: test2:27; CHECK:    std 2, 24(1)28; CHECK-NOT:    std 2, 24(1)29 30; AIX64-LABEL: test2:31; AIX64: std 2, 40(1)32; AIX64-NOT: std 2, 40(1)33 34; AIX32-LABEL: test2:35; AIX32: stw 2, 20(1)36; AIX32-NOT: std 2, 20(1)37  %call = tail call signext i32 %Func(i32 signext %i)38  %tobool = icmp eq i32 %j, 039  br i1 %tobool, label %if.end, label %if.then40 41if.then:                                          ; preds = %entry42  %call1 = tail call signext i32 %Func(i32 signext %i)43  %add2 = add nsw i32 %call1, %call44  %call3 = tail call signext i32 %Func2(i32 signext %i)45  %add4 = add nsw i32 %add2, %call346  br label %if.end47 48if.end:                                           ; preds = %entry, %if.then49  %Sum.0 = phi i32 [ %add4, %if.then ], [ %call, %entry ]50  %call5 = tail call signext i32 %Func(i32 signext %i)51  %add6 = add nsw i32 %call5, %Sum.052  ret i32 %add653}54 55; Check for multiple TOC saves with if then else where neither dominates the other.56define signext i32 @test3(i32 signext %i, ptr nocapture %Func, ptr nocapture %Func2) {57; CHECK-LABEL: test3:58; CHECK:    std 2, 24(1)59; CHECK-NOT:    std 2, 24(1)60 61; AIX64-LABEL: test3:62; AIX64-COUNT-3: std 2, 40(1)63 64; AIX32-LABEL: test3:65; AIX32-COUNT-3: stw 2, 20(1)66entry:67  %tobool = icmp eq i32 %i, 068  br i1 %tobool, label %if.else, label %if.then69 70if.then:                                          ; preds = %entry71  %call = tail call signext i32 %Func(i32 signext %i)72  br label %if.end73 74if.else:                                          ; preds = %entry75  %call1 = tail call signext i32 %Func2(i32 signext 0)76  br label %if.end77 78if.end:                                           ; preds = %if.else, %if.then79  %Sum.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ]80  %call3 = tail call signext i32 %Func(i32 signext %i)81  %add4 = add nsw i32 %call3, %Sum.082  ret i32 %add483}84 85define signext i32 @test4(i32 signext %i, ptr nocapture %Func, ptr nocapture %Func2) {86; CHECK-LABEL: test4:87; CHECK:    std 2, 24(1)88; CHECK-NOT:    std 2, 24(1)89 90; AIX64-LABEL: test4:91; AIX64: std 2, 40(1)92; AIX64-NOT: std 2, 40(1)93 94; AIX32-LABEL: test4:95; AIX32: stw 2, 20(1)96; AIX32-NOT: std 2, 20(1)97entry:98  %call = tail call signext i32 %Func(i32 signext %i)99  %tobool = icmp eq i32 %i, 0100  br i1 %tobool, label %if.else, label %if.then101 102if.then:                                          ; preds = %entry103  %call1 = tail call signext i32 %Func(i32 signext %i)104  br label %if.end105 106if.else:                                          ; preds = %entry107  %call3 = tail call signext i32 %Func2(i32 signext 0)108  br label %if.end109 110if.end:                                           ; preds = %if.else, %if.then111  %call1.pn = phi i32 [ %call1, %if.then ], [ %call3, %if.else ]112  %Sum.0 = add nsw i32 %call1.pn, %call113  ret i32 %Sum.0114}115 116; Check for multiple TOC saves with if then where neither is redundant.117define signext i32 @test5(i32 signext %i, ptr nocapture %Func, ptr nocapture readnone %Func2) {118entry:119; CHECK-LABEL: test5:120; CHECK:    std 2, 24(1)121 122; AIX64-LABEL: test5:123; AIX64: std 2, 40(1)124 125; AIX32-LABEL: test5:126; AIX32: stw 2, 20(1)127  %tobool = icmp eq i32 %i, 0128  br i1 %tobool, label %if.end, label %if.then129 130if.then:                                          ; preds = %entry131  %call = tail call signext i32 %Func(i32 signext %i)132  br label %if.end133 134if.end:                                           ; preds = %entry, %if.then135  %Sum.0 = phi i32 [ %call, %if.then ], [ 0, %entry ]136  %call1 = tail call signext i32 %Func(i32 signext %i)137  %add2 = add nsw i32 %call1, %Sum.0138  ret i32 %add2139}140 141; Check for multiple TOC saves if there are dynamic allocations on the stack.142define signext i32 @test6(i32 signext %i, ptr nocapture %Func, ptr nocapture %Func2) {143entry:144; CHECK-LABEL: test6:145; CHECK:    std 2, 24(1)146; CHECK:    std 2, 24(1)147 148; AIX64-LABEL: test6:149; AIX64: std 2, 40(1)150; AIX64: std 2, 40(1)151 152; AIX32-LABEL: test6:153; AIX32: stw 2, 20(1)154; AIX32: stw 2, 20(1)155  %conv = sext i32 %i to i64156  %0 = alloca i8, i64 %conv, align 16157  %call = tail call signext i32 %Func(i32 signext %i)158  call void @useAlloca(ptr nonnull %0, i32 signext %call)159  %call1 = call signext i32 %Func2(i32 signext %i)160  %add2 = add nsw i32 %call1, %call161  ret i32 %add2162}163 164declare void @useAlloca(ptr, i32 signext)165