1  /* { dg-do compile } */
       2  /* { dg-skip-if "skip override" { *-*-* } { "-mfloat-abi=hard" } { "" } } */
       3  /* { dg-options "-mpure-code -mcpu=cortex-m0 -march=armv6s-m -mthumb -mfloat-abi=soft" } */
       4  /* { dg-final { check-function-bodies "**" "" } } */
       5  
       6  /* Does not use thumb1_gen_const_int.
       7  ** test_0:
       8  **	...
       9  **	movs	r[0-3], #0
      10  **	...
      11  */
      12  int
      13  test_0 ()
      14  {
      15    return 0;
      16  }
      17  
      18  /* Does not use thumb1_gen_const_int.
      19  ** test_128:
      20  **	...
      21  **	movs	r[0-3], #128
      22  **	...
      23  */
      24  int
      25  test_128 ()
      26  {
      27    return 128;
      28  }
      29  
      30  /* Does not use thumb1_gen_const_int.
      31  ** test_264:
      32  **	...
      33  **	movs	r[0-3], #132
      34  **	lsls	r[0-3], r[0-3], #1
      35  **	...
      36  */
      37  int
      38  test_264 ()
      39  {
      40    return 264;
      41  }
      42  
      43  /* Does not use thumb1_gen_const_int.
      44  ** test_510:
      45  **	...
      46  **	movs	r[0-3], #255
      47  **	lsls	r[0-3], r[0-3], #1
      48  **	...
      49  */
      50  int
      51  test_510 ()
      52  {
      53    return 510;
      54  }
      55  
      56  /* Does not use thumb1_gen_const_int.
      57  ** test_512:
      58  **	...
      59  **	movs	r[0-3], #128
      60  **	lsls	r[0-3], r[0-3], #2
      61  **	...
      62  */
      63  int
      64  test_512 ()
      65  {
      66    return 512;
      67  }
      68  
      69  /* Does not use thumb1_gen_const_int.
      70  ** test_764:
      71  **	...
      72  **	movs	r[0-3], #191
      73  **	lsls	r[0-3], r[0-3], #2
      74  **	...
      75  */
      76  int
      77  test_764 ()
      78  {
      79    return 764;
      80  }
      81  
      82  /* Does not use thumb1_gen_const_int.
      83  ** test_65536:
      84  **	...
      85  **	movs	r[0-3], #128
      86  **	lsls	r[0-3], r[0-3], #9
      87  **	...
      88  */
      89  int
      90  test_65536 ()
      91  {
      92    return 65536;
      93  }
      94  
      95  /*
      96  ** test_0x123456:
      97  **	...
      98  **	movs	r[0-3], #18
      99  **	lsls	r[0-3], r[0-3], #8
     100  **	adds	r[0-3], r[0-3], #52
     101  **	lsls	r[0-3], r[0-3], #8
     102  **	adds	r[0-3], r[0-3], #86
     103  **	...
     104  */
     105  int
     106  test_0x123456 ()
     107  {
     108    return 0x123456;
     109  }
     110  
     111  /*
     112  ** test_0x1123456:
     113  **	...
     114  **	movs	r[0-3], #137
     115  **	lsls	r[0-3], r[0-3], #8
     116  **	adds	r[0-3], r[0-3], #26
     117  **	lsls	r[0-3], r[0-3], #8
     118  **	adds	r[0-3], r[0-3], #43
     119  **	lsls	r[0-3], r[0-3], #1
     120  **	...
     121  */
     122  int
     123  test_0x1123456 ()
     124  {
     125    return 0x1123456;
     126  }
     127  
     128  /* With -Os, we generate:
     129     movs r0, #16
     130     lsls r0, r0, r0
     131     With the other optimization levels, we generate:
     132     movs r0, #16
     133     lsls r0, r0, #16
     134     hence the two alternatives.  */
     135  /*
     136  ** test_0x1000010:
     137  **	...
     138  **	movs	r[0-3], #16
     139  **	lsls	r[0-3], r[0-3], (#16|r[0-3])
     140  **	adds	r[0-3], r[0-3], #1
     141  **	lsls	r[0-3], r[0-3], #4
     142  **	...
     143  */
     144  int
     145  test_0x1000010 ()
     146  {
     147    return 0x1000010;
     148  }
     149  
     150  /*
     151  ** test_0x1000011:
     152  **	...
     153  **	movs	r[0-3], #1
     154  **	lsls	r[0-3], r[0-3], #24
     155  **	adds	r[0-3], r[0-3], #17
     156  **	...
     157  */
     158  int
     159  test_0x1000011 ()
     160  {
     161    return 0x1000011;
     162  }
     163  
     164  /*
     165  ** test_m8192:
     166  **	...
     167  **	movs	r[0-3], #1
     168  **	lsls	r[0-3], r[0-3], #13
     169  **	rsbs	r[0-3], r[0-3], #0
     170  **	...
     171  */
     172  int
     173  test_m8192 ()
     174  {
     175    return -8192;
     176  }