Commit 277b4867 by Jan Hubicka Committed by Jan Hubicka

cold-attribute-1.c: New testcase.


	* gcc.target/i386/cold-attribute-1.c: New testcase.
	* gcc.target/i386/cold-attribute-2.c: New testcase.
	* gcc.target/i386/cold-attribute-3.c: New testcase.
	* gcc.target/i386/cold-attribute-4.c: New testcase.
	* predict.c (PROB_VERY_LIKELY): Make small enough so things
	become cold.
	* predict.def (PRED_NORETURN_CALL, PRED_COLD_CALL): Use it.

From-SVN: r139827
parent 8518c095
2008-08-31 Jan Hubicka <jh@suse.cz>
* predict.c (PROB_VERY_LIKELY): Make small enough so things
become cold.
* predict.def (PRED_NORETURN_CALL, PRED_COLD_CALL): Use it.
2008-08-31 Jakub Jelinek <jakub@redhat.com> 2008-08-31 Jakub Jelinek <jakub@redhat.com>
PR debug/37287 PR debug/37287
......
...@@ -66,8 +66,10 @@ along with GCC; see the file COPYING3. If not see ...@@ -66,8 +66,10 @@ along with GCC; see the file COPYING3. If not see
static sreal real_zero, real_one, real_almost_one, real_br_prob_base, static sreal real_zero, real_one, real_almost_one, real_br_prob_base,
real_inv_br_prob_base, real_one_half, real_bb_freq_max; real_inv_br_prob_base, real_one_half, real_bb_freq_max;
/* Random guesstimation given names. */ /* Random guesstimation given names.
#define PROB_VERY_UNLIKELY (REG_BR_PROB_BASE / 100 - 1) PROV_VERY_UNLIKELY should be small enough so basic block predicted
by it gets bellow HOT_BB_FREQUENCY_FRANCTION. */
#define PROB_VERY_UNLIKELY (REG_BR_PROB_BASE / 2000 - 1)
#define PROB_EVEN (REG_BR_PROB_BASE / 2) #define PROB_EVEN (REG_BR_PROB_BASE / 2)
#define PROB_VERY_LIKELY (REG_BR_PROB_BASE - PROB_VERY_UNLIKELY) #define PROB_VERY_LIKELY (REG_BR_PROB_BASE - PROB_VERY_UNLIKELY)
#define PROB_ALWAYS (REG_BR_PROB_BASE) #define PROB_ALWAYS (REG_BR_PROB_BASE)
......
...@@ -69,11 +69,11 @@ DEF_PREDICTOR (PRED_LOOP_ITERATIONS_GUESSED, "guessed loop iterations", ...@@ -69,11 +69,11 @@ DEF_PREDICTOR (PRED_LOOP_ITERATIONS_GUESSED, "guessed loop iterations",
DEF_PREDICTOR (PRED_CONTINUE, "continue", HITRATE (50), 0) DEF_PREDICTOR (PRED_CONTINUE, "continue", HITRATE (50), 0)
/* Branch to basic block containing call marked by noreturn attribute. */ /* Branch to basic block containing call marked by noreturn attribute. */
DEF_PREDICTOR (PRED_NORETURN, "noreturn call", HITRATE (99), DEF_PREDICTOR (PRED_NORETURN, "noreturn call", PROB_VERY_LIKELY,
PRED_FLAG_FIRST_MATCH) PRED_FLAG_FIRST_MATCH)
/* Branch to basic block containing call marked by cold function attribute. */ /* Branch to basic block containing call marked by cold function attribute. */
DEF_PREDICTOR (PRED_COLD_FUNCTION, "cold function call", HITRATE (99), DEF_PREDICTOR (PRED_COLD_FUNCTION, "cold function call", PROB_VERY_LIKELY,
PRED_FLAG_FIRST_MATCH) PRED_FLAG_FIRST_MATCH)
/* Loopback edge is taken. */ /* Loopback edge is taken. */
......
2008-08-31 Jan Hubicka <jh@suse.cz>
* gcc.target/i386/cold-attribute-1.c: New testcase.
* gcc.target/i386/cold-attribute-2.c: New testcase.
* gcc.target/i386/cold-attribute-3.c: New testcase.
* gcc.target/i386/cold-attribute-4.c: New testcase.
2008-08-31 Jakub Jelinek <jakub@redhat.com> 2008-08-31 Jakub Jelinek <jakub@redhat.com>
PR debug/37287 PR debug/37287
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
#include <string.h>
static inline
__attribute__ ((cold))
my_cold_memset (void *a, int b,int c)
{
memset (a,b,c);
}
t(void *a,int b,int c)
{
if (a)
my_cold_memset (a,b,c);
}
/* The IF conditional should be predicted as cold and my_cold_memset inlined
for size expanding memset as rep; stosb. */
/* { dg-final { scan-assembler "stosb" } } */
/* { dg-do compile } */
/* { dg-options "-O2" } */
#include <string.h>
t(int c)
{
if (__builtin_expect (c, 0))
{
cold_hint ();
return c * 11;
}
return c;
}
/* { dg-final { scan-assembler "imul" } } */
/* { dg-do compile } */
/* { dg-options "-O2" } */
#include <string.h>
int
__attribute__ ((cold))
t(int c)
{
return c * 11;
}
/* { dg-final { scan-assembler "imul" } } */
/* { dg-do compile } */
/* { dg-options "-O2" } */
#include <string.h>
int
__attribute__ ((cold))
t(int c)
{
return -1;
}
/* { dg-final { scan-assembler "orl" } } */
.file "cold-attribute-4.c"
.text
.p2align 4,,15
.globl t
.type t, @function
t:
.LFB14:
movl $-1, %eax
ret
.LFE14:
.size t, .-t
.section .eh_frame,"a",@progbits
.Lframe1:
.long .LECIE1-.LSCIE1
.LSCIE1:
.long 0x0
.byte 0x1
.string "zR"
.uleb128 0x1
.sleb128 -8
.byte 0x10
.uleb128 0x1
.byte 0x3
.byte 0xc
.uleb128 0x7
.uleb128 0x8
.byte 0x90
.uleb128 0x1
.align 8
.LECIE1:
.LSFDE1:
.long .LEFDE1-.LASFDE1
.LASFDE1:
.long .LASFDE1-.Lframe1
.long .LFB14
.long .LFE14-.LFB14
.uleb128 0x0
.align 8
.LEFDE1:
.ident "GCC: (GNU) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)"
.section .note.GNU-stack,"",@progbits
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment