1 int flia(long a)
   2 {
   3         return __builtin_expect(a, 1);
   4 }
   5 
   6 int flic(void)
   7 {
   8         return __builtin_expect(1L << 32 | 1, 1);
   9 }
  10 
  11 long fila(int a)
  12 {
  13         return __builtin_expect(a, 1);
  14 }
  15 
  16 long filc(void)
  17 {
  18         return __builtin_expect(1L << 32 | 1, 1);
  19 }
  20 
  21 long filu(void)
  22 {
  23         return __builtin_expect(0x80000000U, 1);
  24 }
  25 
  26 long fils(void)
  27 {
  28         return __builtin_expect((int)0x80000000, 1);
  29 }
  30 
  31 void *fptr(void *a)
  32 {
  33         return __builtin_expect(a, a);
  34 }
  35 
  36 /*
  37  * check-name: builtin-expect
  38  * check-command: test-linearize -m64 -Wno-decl $file
  39  * check-assert: sizeof(long) == 8
  40  *
  41  * check-output-start
  42 flia:
  43 .L0:
  44         <entry-point>
  45         trunc.32    %r2 <- (64) %arg1
  46         ret.32      %r2
  47 
  48 
  49 flic:
  50 .L2:
  51         <entry-point>
  52         ret.32      $1
  53 
  54 
  55 fila:
  56 .L4:
  57         <entry-point>
  58         sext.64     %r6 <- (32) %arg1
  59         ret.64      %r6
  60 
  61 
  62 filc:
  63 .L6:
  64         <entry-point>
  65         ret.64      $0x100000001
  66 
  67 
  68 filu:
  69 .L8:
  70         <entry-point>
  71         ret.64      $0x80000000
  72 
  73 
  74 fils:
  75 .L10:
  76         <entry-point>
  77         ret.64      $0xffffffff80000000
  78 
  79 
  80 fptr:
  81 .L12:
  82         <entry-point>
  83         ret.64      %arg1
  84 
  85 
  86  * check-output-end
  87  *
  88  * check-error-start
  89 expand/builtin-expect.c:33:33: warning: incorrect type in argument 1 (different base types)
  90 expand/builtin-expect.c:33:33:    expected long
  91 expand/builtin-expect.c:33:33:    got void *a
  92 expand/builtin-expect.c:33:36: warning: incorrect type in argument 2 (different base types)
  93 expand/builtin-expect.c:33:36:    expected long
  94 expand/builtin-expect.c:33:36:    got void *a
  95 expand/builtin-expect.c:33:32: warning: incorrect type in return expression (different base types)
  96 expand/builtin-expect.c:33:32:    expected void *
  97 expand/builtin-expect.c:33:32:    got long
  98 expand/builtin-expect.c:8:42: warning: cast truncates bits from constant value (100000001 becomes 1)
  99  * check-error-end
 100  */