From ad626132a9fea9f82065610bae552200d8cb1545 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Mon, 17 Jun 2013 21:45:16 +0000 Subject: [PATCH] Reenable, improve, and add MI-Sched unit tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184134 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/misched-balance.ll | 51 +++++++++++++++++++++++++++-- test/CodeGen/X86/misched-matmul.ll | 5 ++- test/CodeGen/X86/misched-matrix.ll | 19 +++++------ 3 files changed, 60 insertions(+), 15 deletions(-) diff --git a/test/CodeGen/X86/misched-balance.ll b/test/CodeGen/X86/misched-balance.ll index 526b9d718d2..5f6c50175c1 100644 --- a/test/CodeGen/X86/misched-balance.ll +++ b/test/CodeGen/X86/misched-balance.ll @@ -1,5 +1,4 @@ -; RUN-disabled: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched -verify-machineinstrs | FileCheck %s -; RUN: true +; RUN: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched -verify-machineinstrs | FileCheck %s ; ; Verify that misched resource/latency balancy heuristics are sane. @@ -228,3 +227,51 @@ for.body: end: ret void } + +; A mildly interesting little block extracted from a cipher. The +; balanced heuristics are interesting here because we have resource, +; latency, and register limits all at once. For now, simply check that +; we don't use any callee-saves. +; CHECK: @encpc1 +; CHECK: %entry +; CHECK-NOT: push +; CHECK-NOT: pop +; CHECK: ret +@a = external global i32, align 4 +@b = external global i32, align 4 +@c = external global i32, align 4 +@d = external global i32, align 4 +define i32 @encpc1() nounwind { +entry: + %l1 = load i32* @a, align 16 + %conv = shl i32 %l1, 8 + %s5 = lshr i32 %l1, 8 + %add = or i32 %conv, %s5 + store i32 %add, i32* @b + %l6 = load i32* @a + %l7 = load i32* @c + %add.i = add i32 %l7, %l6 + %idxprom.i = zext i32 %l7 to i64 + %arrayidx.i = getelementptr inbounds i32* @d, i64 %idxprom.i + %l8 = load i32* %arrayidx.i + store i32 346, i32* @c + store i32 20021, i32* @d + %l9 = load i32* @a + store i32 %l8, i32* @a + store i32 %l9, i32* @b + store i32 %add.i, i32* @c + store i32 %l9, i32* @d + %cmp.i = icmp eq i32 %add.i, 0 + %s10 = lshr i32 %l1, 16 + %s12 = lshr i32 %l1, 24 + %s14 = lshr i32 %l1, 30 + br i1 %cmp.i, label %if, label %return +if: + %sa = add i32 %s5, %s10 + %sb = add i32 %sa, %s12 + %sc = add i32 %sb, %s14 + br label %return +return: + %result = phi i32 [0, %entry], [%sc, %if] + ret i32 %result +} diff --git a/test/CodeGen/X86/misched-matmul.ll b/test/CodeGen/X86/misched-matmul.ll index 7ad54bdc27a..6e6ec0bbe57 100644 --- a/test/CodeGen/X86/misched-matmul.ll +++ b/test/CodeGen/X86/misched-matmul.ll @@ -1,6 +1,5 @@ ; REQUIRES: asserts -; RUN-disabled: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched -stats 2>&1 | FileCheck %s -; RUN: true +; RUN: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched -stats 2>&1 | FileCheck %s ; ; Verify that register pressure heuristics are working in MachineScheduler. ; @@ -8,7 +7,7 @@ ; flag to disable it for this test case. ; ; CHECK: @wrap_mul4 -; CHECK: 30 regalloc - Number of spills inserted +; CHECK: 24 regalloc - Number of spills inserted define void @wrap_mul4(double* nocapture %Out, [4 x double]* nocapture %A, [4 x double]* nocapture %B) #0 { entry: diff --git a/test/CodeGen/X86/misched-matrix.ll b/test/CodeGen/X86/misched-matrix.ll index dee54d9c279..4dc95c5e932 100644 --- a/test/CodeGen/X86/misched-matrix.ll +++ b/test/CodeGen/X86/misched-matrix.ll @@ -1,13 +1,12 @@ -; RUN-disabled: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched \ -; RUN-disabled: -misched-topdown -verify-machineinstrs \ -; RUN-disabled: | FileCheck %s -check-prefix=TOPDOWN -; RUN-disabled: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched \ -; RUN-disabled: -misched=ilpmin -verify-machineinstrs \ -; RUN-disabled: | FileCheck %s -check-prefix=ILPMIN -; RUN-disabled: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched \ -; RUN-disabled: -misched=ilpmax -verify-machineinstrs \ -; RUN-disabled: | FileCheck %s -check-prefix=ILPMAX -; RUN: true +; RUN: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched \ +; RUN: -misched-topdown -verify-machineinstrs \ +; RUN: | FileCheck %s -check-prefix=TOPDOWN +; RUN: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched \ +; RUN: -misched=ilpmin -verify-machineinstrs \ +; RUN: | FileCheck %s -check-prefix=ILPMIN +; RUN: llc < %s -march=x86-64 -mcpu=core2 -pre-RA-sched=source -enable-misched \ +; RUN: -misched=ilpmax -verify-machineinstrs \ +; RUN: | FileCheck %s -check-prefix=ILPMAX ; ; Verify that the MI scheduler minimizes register pressure for a ; uniform set of bottom-up subtrees (unrolled matrix multiply).