From 9b569177eb00fc6bd499485382af1c86c98788bf Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 17 Aug 2010 17:55:58 -0700 Subject: [PATCH] sse: better choosing of alignment var This causes a bunch of test programs to increase in speed by 10-20%, specifically those that have larger source sizes than dest sizes. The one notable exception is orc_interleave_s16, which decreases in speed by 50%, even though there is no apparent change in code. WTF. --- orc/orcprogram-sse.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/orc/orcprogram-sse.c b/orc/orcprogram-sse.c index f4906fc..a2dfe05 100644 --- a/orc/orcprogram-sse.c +++ b/orc/orcprogram-sse.c @@ -475,8 +475,23 @@ sse_add_strides (OrcCompiler *compiler) static int get_align_var (OrcCompiler *compiler) { - if (compiler->vars[ORC_VAR_D1].size) return ORC_VAR_D1; - if (compiler->vars[ORC_VAR_S1].size) return ORC_VAR_S1; + int i; + for(i=ORC_VAR_D1;i<=ORC_VAR_S8;i++){ + if (compiler->vars[i].size == 0) continue; + if ((compiler->vars[i].size << compiler->loop_shift) >= 16) { + return i; + } + } + for(i=ORC_VAR_D1;i<=ORC_VAR_S8;i++){ + if (compiler->vars[i].size == 0) continue; + if ((compiler->vars[i].size << compiler->loop_shift) >= 8) { + return i; + } + } + for(i=ORC_VAR_D1;i<=ORC_VAR_S8;i++){ + if (compiler->vars[i].size == 0) continue; + return i; + } ORC_COMPILER_ERROR(compiler, "could not find alignment variable"); -- 2.7.4