From fca710bf701beb540b335eb6a6ed38c6dada9590 Mon Sep 17 00:00:00 2001 From: Preston Gurd Date: Tue, 2 Apr 2013 14:25:06 +0000 Subject: [PATCH] Simplify test cases for Atom preferring call register indirect over call memory indirect (32 and 64 bit). llvm-svn: 178541 --- .../atom-call-reg-indirect-foldedreload32.ll | 261 +++++----------- .../atom-call-reg-indirect-foldedreload64.ll | 284 +++++------------- 2 files changed, 148 insertions(+), 397 deletions(-) diff --git a/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll b/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll index 4192f13d896..2a34e0298f3 100644 --- a/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll +++ b/test/CodeGen/X86/atom-call-reg-indirect-foldedreload32.ll @@ -1,204 +1,77 @@ ; RUN: llc < %s -mtriple=i386-linux-gnu -mcpu=atom 2>&1 | \ ; RUN: grep "calll" | not grep "(" ; RUN: llc < %s -mtriple=i386-linux-gnu -mcpu=core2 2>&1 | \ -; RUN: grep "calll" | grep "4-byte Folded Reload" +; RUN: grep "calll" | grep "*funcp" +; +; original source code built with clang -S -emit-llvm -M32 test32.c: +; +; int a, b, c, d, e, f, g, h, i, j; +; extern int (*funcp)(int, int, int, int, int, int, int, int); +; extern int sum; +; +; void func() +; { +; sum = 0; +; for( i = a; i < b; ++i ) +; { +; sum += (*funcp)(i, b, c, d, e, f, g, h); +; } +; } +; +; ModuleID = 'test32.c' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" +target triple = "i386-unknown-linux-gnu" -%struct.targettype = type {i32} -%struct.op_ptr1 = type opaque -%struct.op_ptr2 = type opaque -%union.anon = type { [8 x i32], [48 x i8] } -%struct.const1 = type { [64 x i16], i8 } -%struct.const2 = type { [17 x i8], [256 x i8], i8 } +@sum = external global i32 +@a = common global i32 0, align 4 +@i = common global i32 0, align 4 +@b = common global i32 0, align 4 +@funcp = external global i32 (i32, i32, i32, i32, i32, i32, i32, i32)* +@c = common global i32 0, align 4 +@d = common global i32 0, align 4 +@e = common global i32 0, align 4 +@f = common global i32 0, align 4 +@g = common global i32 0, align 4 +@h = common global i32 0, align 4 +@j = common global i32 0, align 4 -%struct.ref1 = type { void (%struct.ref2*)*, i32 (%struct.ref2*)*, void (%struct.ref2*)*, i32 (%struct.ref2*, i8***)*, %struct.op_ptr2** } -%struct.ref2 = type { %struct.localref13*, %struct.localref15*, %struct.localref12*, i8*, i8, i32, %struct.localref11*, i32, i32, i32, i32, i32, i32, i32, double, i8, i8, i32, i8, i8, i8, i32, i8, i32, i8, i8, i8, i32, i32, i32, i32, i32, i32, i8**, i32, i32, i32, i32, i32, [64 x i32]*, [4 x %struct.const1*], [4 x %struct.const2*], [4 x %struct.const2*], i32, %struct.ref3*, i8, i8, [16 x i8], [16 x i8], [16 x i8], i32, i8, i8, i8, i8, i16, i16, i8, i8, i8, %struct.localref10*, i32, i32, i32, i32, i8*, i32, [4 x %struct.ref3*], i32, i32, i32, [10 x i32], i32, i32, i32, i32, i32, %struct.localref8*, %struct.localref9*, %struct.ref1*, %struct.localref7*, %struct.localref6*, %struct.localref5*, %struct.localref1*, %struct.ref4*, %struct.localref2*, %struct.localref3*, %struct.localref4* } -%struct.ref3 = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i32, i32, i32, i32, i32, i32, %struct.const1*, i8* } -%struct.ref4 = type { void (%struct.ref2*)*, [5 x void (%struct.ref2*, %struct.ref3*, i16*, i8**, i32)*] } +define void @func() #0 { +entry: + store i32 0, i32* @sum, align 4 + %0 = load i32* @a, align 4 + store i32 %0, i32* @i, align 4 + br label %for.cond -%struct.localref1 = type { void (%struct.ref2*)*, i8 (%struct.ref2*, [64 x i16]**)*, i8 } -%struct.localref2 = type { void (%struct.ref2*)*, void (%struct.ref2*, i8***, i32*, i32, i8**, i32*, i32)*, i8 } -%struct.localref3 = type { void (%struct.ref2*)*, void (%struct.ref2*, i8***, i32, i8**, i32)* } -%struct.localref4 = type { {}*, void (%struct.ref2*, i8**, i8**, i32)*, void (%struct.ref2*)*, void (%struct.ref2*)* } -%struct.localref5 = type { void (%struct.ref2*)*, i32 (%struct.ref2*)*, i8 (%struct.ref2*)*, i8, i8, i32, i32 } -%struct.localref6 = type { i32 (%struct.ref2*)*, void (%struct.ref2*)*, void (%struct.ref2*)*, void (%struct.ref2*)*, i8, i8 } -%struct.localref7 = type { void (%struct.ref2*, i32)*, void (%struct.ref2*, i8***, i32*, i32, i8**, i32*, i32)* } -%struct.localref8 = type { void (%struct.ref2*)*, void (%struct.ref2*)*, i8 } -%struct.localref9 = type { void (%struct.ref2*, i32)*, void (%struct.ref2*, i8**, i32*, i32)* } -%struct.localref10 = type { %struct.localref10*, i8, i32, i32, i8* } -%struct.localref11 = type { i8*, %struct.targettype, void (%struct.ref2*)*, i8 (%struct.ref2*)*, void (%struct.ref2*, %struct.targettype)*, i8 (%struct.ref2*, i32)*, void (%struct.ref2*)* } -%struct.localref12 = type { {}*, %struct.targettype, %struct.targettype, i32, i32 } -%struct.localref13 = type { void (%struct.localref14*)*, void (%struct.localref14*, i32)*, void (%struct.localref14*)*, void (%struct.localref14*, i8*)*, void (%struct.localref14*)*, i32, %union.anon, i32, %struct.targettype, i8**, i32, i8**, i32, i32 } -%struct.localref14 = type { %struct.localref13*, %struct.localref15*, %struct.localref12*, i8*, i8, i32 } -%struct.localref15 = type { i8* (%struct.localref14*, i32, %struct.targettype)*, i8* (%struct.localref14*, i32, %struct.targettype)*, i8** (%struct.localref14*, i32, i32, i32)*, [64 x i16]** (%struct.localref14*, i32, i32, i32)*, %struct.op_ptr1* (%struct.localref14*, i32, i8, i32, i32, i32)*, %struct.op_ptr2* (%struct.localref14*, i32, i8, i32, i32, i32)*, {}*, i8** (%struct.localref14*, %struct.op_ptr1*, i32, i32, i8)*, [64 x i16]** (%struct.localref14*, %struct.op_ptr2*, i32, i32, i8)*, void (%struct.localref14*, i32)*, {}*, %struct.targettype, %struct.targettype} +for.cond: ; preds = %for.inc, %entry + %1 = load i32* @i, align 4 + %2 = load i32* @b, align 4 + %cmp = icmp slt i32 %1, %2 + br i1 %cmp, label %for.body, label %for.end -define internal i32 @foldedreload(%struct.ref2* %cinfo, i8*** nocapture %output1) { - %1 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 79 - %2 = load %struct.ref1** %1, align 4 - %3 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 68 - %4 = load i32* %3, align 4 - %5 = add i32 %4, -1 - %6 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 64 - %7 = load i32* %6, align 4 - %8 = add i32 %7, -1 - %9 = getelementptr inbounds %struct.ref1* %2, i32 1, i32 1 - %10 = bitcast i32 (%struct.ref2*)** %9 to i32* - %11 = load i32* %10, align 4 - %12 = getelementptr inbounds %struct.ref1* %2, i32 1, i32 2 - %13 = bitcast void (%struct.ref2*)** %12 to i32* - %14 = load i32* %13, align 4 - %15 = icmp slt i32 %11, %14 - br i1 %15, label %.lr.ph18, label %._crit_edge19 +for.body: ; preds = %for.cond + %3 = load i32 (i32, i32, i32, i32, i32, i32, i32, i32)** @funcp, align 4 + %4 = load i32* @i, align 4 + %5 = load i32* @b, align 4 + %6 = load i32* @c, align 4 + %7 = load i32* @d, align 4 + %8 = load i32* @e, align 4 + %9 = load i32* @f, align 4 + %10 = load i32* @g, align 4 + %11 = load i32* @h, align 4 + %call = call i32 %3(i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11) + %12 = load i32* @sum, align 4 + %add = add nsw i32 %12, %call + store i32 %add, i32* @sum, align 4 + br label %for.inc -.lr.ph18: - %16 = getelementptr inbounds %struct.ref1* %2, i32 1 - %17 = bitcast %struct.ref1* %16 to i32* - %18 = getelementptr inbounds %struct.ref1* %16, i32 0, i32 0 - %19 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 66 - %20 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 84 - %21 = getelementptr inbounds %struct.ref2* %cinfo, i32 0, i32 36 - %22 = getelementptr inbounds %struct.ref1* %2, i32 1, i32 3 - %23 = bitcast i32 (%struct.ref2*, i8***)** %22 to [10 x [64 x i16]*]* - %.pre = load i32* %17, align 4 - br label %24 +for.inc: ; preds = %for.body + %13 = load i32* @i, align 4 + %inc = add nsw i32 %13, 1 + store i32 %inc, i32* @i, align 4 + br label %for.cond -;