File: gcc-3.3.6-m68hc1x-20060122.diffs

package info (click to toggle)
gcc-m68hc1x 1%3A3.3.6%2B3.1%2Bdfsg-3
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, lenny, squeeze, stretch, wheezy
  • size: 20,884 kB
  • ctags: 282
  • sloc: ansic: 404; makefile: 110; asm: 42; sh: 1
file content (10271 lines) | stat: -rw-r--r-- 286,875 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/ChangeLog.M68HC11 gcc-3.3.6-m68hc1x/ChangeLog.M68HC11
--- gcc-3.3.6/ChangeLog.M68HC11	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/ChangeLog.M68HC11	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,4 @@
+2003-05-18  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* configure.in (m68hc11): Configure libstdcxx_version.
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/ChangeLog.M68HC11 gcc-3.3.6-m68hc1x/gcc/ChangeLog.M68HC11
--- gcc-3.3.6/gcc/ChangeLog.M68HC11	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/ChangeLog.M68HC11	Sun Jan 22 21:17:21 2006
@@ -0,0 +1,373 @@
+2006-01-22  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c: Bump to 2006-01-22
+
+2006-01-22  Stephane Carrez  <stcarrez@nerim.fr>
+
+        PR savannah/13917
+	* config/m68hc11/m68hc11.c (nonimmediate_noinc_operand): New predicate.
+	* config/m68hc11/m68hc11-protos.h (nonimmediate_noinc_operand): Declare.
+	* config/m68hc11/m68hc11.h (PREDICATE_CODES): Register it.
+	* config/m68hc11/m68hc11.md ("addqi3"): Use it for operand 0, 1.
+	("uminqi3"): Likewise.
+	("umaxqi3"): Likewise.
+	("uminhi3"): Likewise.
+	("umaxhi3"): Likewise.
+	("negqi2"): Likewise.
+	("*ashlqi3_const1", "*ashrqi3_const1"): Likewise.
+	("lshrhi3_const", "*lshrqi3_const1"): Likewise.
+
+2006-01-20  Stephane Carrez  <stcarrez@nerim.fr>
+
+	savannah/15493
+	* config/m68hc11/m68hc11.c (m68hc11_gen_movqi): Must save register
+	A and copy X or Y in it for a move when both operands refer to X or Y.
+
+2005-11-05  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR savannah/13879
+	* expmed.c (make_tree): If we have a constant for SIGN_EXTEND or
+	ZERO_EXTEND, use the mode from the extend node; the constant is VOIDmode
+	and it will crash.
+
+2005-11-05  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* expmed.c (store_bit_field): Must apply a correction for big-endian
+	target when the bitfield contains less word than the source constant.
+
+2005-05-15  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.h (REG_VALID_P): The macro can be used with
+	signed numbers passed as argument.
+	* version.c: Bump to 20050515
+
+2005-05-08  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR savannah/12572
+	* config/m68hc11/m68hc11.md ("movhi"): Sign extend the constants in
+	the range 32768..65535 so that the generated set is recognized.
+
+2005-05-08  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("mulqi3"): Use general_operand for operand
+	1 and fix constraints.
+	("mulqihi3")" Use general_operand for operand 2.
+	* config/m68hc11/m68hc11.c (m68hc11_gen_movqi): Use pula and pulb
+	instead of lda and ldb for 68HC12.
+
+2005-05-08  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11-protos.h (m68hc11_hard_regno_rename_ok): Pass
+	the mode.
+	* config/m68hc11/m68hc11.h (HARD_REGNO_RENAME_OK): Likewise.
+	* config/m68hc11/m68hc11.c (m68hc11_hard_regno_rename_ok): Likewise.
+	* regrename.c (regrename_optimize): Pass the mode in which the register
+	is used.
+
+2005-04-03  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR savannah/12297
+	* config/m68hc11/m68hc11.c (m68hc11_z_replacement): Use emit_insn_after
+	when adding the save Z instruction so that it is part of the good BB.
+
+2005-02-13  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR target/17551
+	* gcse.c (handle_avail_expr): Use gen_move_insn() instead of
+	gen_rtx_SET()
+
+2005-02-13  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR target/16925
+	* config/m68hc11/m68hc11.c (m68hc11_gen_highpart): Handle split of
+	64-bit constants on 64-bit hosts.
+	(m68hc11_split_logical): Simplify.
+	(m68hc11_split_move): Likewise.
+
+2005-02-12  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR savannah/11813
+	* config/m68hc11/m68hc11.c (reg_or_some_mem_operand): Do not allow
+	the 68HC12 address indirect addressing mode as it is not supported
+	by bset and bclr.
+
+2005-01-29  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c (version_string): Bump to 2005-01-29.
+	* config/udivmodsi4.c (__udivmodsi4): Rewrite ediv as it didn't
+	passed the gcc validation.
+
+2005-01-28  Stephane Carrez  <stcarrez@nerim.fr>
+
+	From philipljohnson@comcast.net:
+
+	Patch savannah/3626
+	* config/udivmodsi4.c (__udivmodsi4): Use 68HC12 ediv instruction to
+	compute division and modulus.
+
+2004-08-30  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.c (m68hc11_gen_movhi): Fix invalid generation
+	of indexed indirect addressing with movw
+
+2004-08-29  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c (version_string): Bump to 2004-08-29.
+
+2004-08-29  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* final.c (alter_subreg): Adjust the offset of paradoxical subreg
+	so that we load the correct value.
+
+2004-08-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("movhi_const0"): Use this pattern only
+	for 68HC11.
+
+2004-08-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c (version_string): Bump to 2004-08-01 and use gcc 3.3.4.
+
+2004-06-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR target/14542
+	* config/m68hc11/m68hc11.md (move peephole2): Emit a use note to avoid
+	a live change of a register after peephole replacement.
+
+2004-06-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR target/14457
+	* config/m68hc11/m68hc11.c (splitable_operand): New predicate.
+	* config/m68hc11/m68hc11-protos.h (splitable_operand): Declare.
+	* config/m68hc11/m68hc11.h (PREDICATE_CODES): Register it.
+	(inhibit_libc): Must define.
+	* config/m68hc11/m68hc11.md ("movhi_const0"): Use splitable_operand.
+	("*andhi3_gen", "iorhi3", "*iorhi3_gen"): Likewise.
+	("xorhi3"): Likewise.
+
+2004-04-25  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("iorqi3_gen"): Use general_operand for
+	first operand.
+	("*andqi3_gen", "xorqi3"): Likewise.
+	("subqi3", "*subhi3"): Likewise.
+	("*addhi3_zext"): Likewise.
+
+2004-04-25  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.h (ASM_OUTPUT_LABELREF): Redefine to strip
+	any name encoding.
+
+2004-03-07  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*lshrsi3_const"): Disable for 68HC12.
+	("*lshrsi3"): Also accept an immediate for 68HC12.
+	("*ashrsi3_const"): Likewise.
+	("*ashrsi3"): Likewise.
+	("*ashlsi3_const"): Likewise.
+	("*ashlsi3"): Likewise.
+	("cmphi_1_hc12"): Compare two hard register by pushing them and
+	comparing with a pop; don't use a split for that.
+	("cmphi split"): Disable compare split for 68HC12.
+
+2004-03-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*lshrsi3_const1"): Allow a memory for
+	operand 1 when operand 0 is a soft register.
+	("*ashlsi3_const1"): Likewise.
+
+2004-03-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.c (m68hc11_gen_movhi): Use 2,-sp to push
+	the stack register.
+
+2004-03-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* doc/extend.texi (Function Attributes): Document page0, trap and
+	update far documentation.
+
+2004-03-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR savannah/4987:
+	* doc/invoke.texi (M68hc1x Options): Document -mrelax
+
+2004-03-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR savannah/8028:
+	* config/m68hc11/m68hc11.c (expand_prologue): Don't make an interrupt
+	or a trap handler a far symbol.
+	(m68hc11_initial_elimination_offset): Likewise.
+
+2004-03-06  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*lshrsi3_const1"): Tune constraints
+	to optimize more case where we don't need a scratch register.
+	("*ashlsi3_const1"): Likewise.
+	("*pushdi_internal"): New insn and split
+	to separate push from moves.
+	("*pushdf_internal"): Likewise.
+	("*pushsf_internal"): Likewise.
+	("*pushsi_internal"): Likewise.
+	("movdi_internal"): Use define_insn_and_split; non push operand.
+	("movdf_internal"): Likewise.
+	("movsf_internal"): Likewise.
+	("movsi_internal"): Likewise.
+
+2004-03-02  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.c (m68hc11_addr_mode): New variable.
+	(m68hc11_mov_addr_mode): Likewise.
+	(m68hc11_override_options): Initialize them based on target.
+	(register_indirect_p): Allow a MEM for indirect addressing modes and
+	use flags to control what is allowed.
+	(m68hc11_small_indexed_indirect_p): Use m68hc11_mov_addr_mode for
+	supported addressing modes.
+	(m68hc11_register_indirect_p): Use m68hc11_addr_mode.
+	(go_if_legitimate_address_internal): Likewise.
+	(m68hc11_indirect_p): Likewise and check the mode.
+	(print_operand): Allow a (MEM (MEM)) and generate indirect addressing.
+
+2004-02-22  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c: Bump to 20040222 and use gcc 3.3.3.
+
+2003-11-16  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c: Bump to 200311116.
+
+2003-11-10  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11-protos.h (m68hc11_page0_symbol_p): Declare.
+	* config/m68hc11/m68hc11.c (m68hc11_page0_symbol_p): New predicate.
+	(m68hc11_indirect_p): Use it.
+	(print_operand): Likewise.
+	(m68hc11_handle_page0_attribute): New function to handle page0
+	attribute
+	(m68hc11_attribute_table): New attribute page0
+	(m68hc11_encode_section_info): Check page0 attribute.
+	* config/m68hc11/m68hc11.md: Use define_insn_and_split
+	(peephole2): New peephole to generate bset/bclr.
+	(peephole): New peephole to optimize compare in few cases and
+	setting of 2 registers from memory.
+
+2003-10-04  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c: Bump to 20031004.
+
+2003-10-04  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR savannah/3432:
+	* config/m68hc11/t-m68hc11-gas (MULTILIB_MATCHES): m68hcs12 is
+	identical to m68hc12 for libraries.
+
+2003-10-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c: Bump to 20031001.
+
+2003-09-30  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*ashldi3_const32"): Adjust first operand
+	if it uses stack pointer register.
+
+2003-09-30  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md (peephole2 "remove one load"): Make sure
+	that register operand 3 does not appear in operand 2.
+
+2003-08-08  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* version.c: Bump to 20030808
+
+2003-08-02  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md (peephole2 "leas 2,sp"): Enable it
+	and add a use rtx.
+	(peephole2): New peephole to optimize moves on stack.
+
+2003-07-19  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md (peephole2 abx): Use m68hc11_gen_lowpart
+	to make sure the constant has the appropriate QImode.
+
+2003-07-08  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.h (HAVE_AS_DWARF2_DEBUG_LINE): Don't define
+	as .file/.loc directives are incompatible with linker relaxation.
+
+2003-05-19  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*movqi" split): Don't split when source
+	or destination is d, b or a register.
+
+2003-05-18  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*logicalhi3_zexthi_ashift8): Allow
+	address registers for operand 1 and 2.
+
+2003-05-18  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* reload.c (find_reloads_toplev): Do not reload the paradoxical
+	subreg with its wider mode but the register itself.
+
+2003-05-18  Stephane Carrez  <stcarrez@nerim.fr>
+
+	Merge 3.0.4-20030501 patchs in 3.3
+
+	2003-03-12  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md
+	("movdi_internal", "movdf_internal"): Fix constraints.
+	("movsi_internal", "movsf_internal"): Likewise.
+	(peephole2): New peephole2 to optimize the address computations
+	by using 'abx' and 'aby'.
+	(peephole2): New peephole2 to optimize 32-bit shift and use only
+	one hard register instead of two.
+	(peephole2): New peephole2 to avoid loading the same value in two
+	different registers.
+
+	2003-03-12  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md (split "logicalsi3_silshl16_zext"): Split
+	after reload but reject the particular case that generates a xgdx 
+	pattern, it must be handled after Z register replacement.
+
+	2003-03-10  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*addhi3_68hc12"): Accept any constant
+	when adding to X and Y since leax/leay are fast.
+	("*addhi3"): Accept 'I' constraint when adding to address register.
+
+	2003-02-27  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*logicalsi3_silshr16"): Accept D reg
+	on all operands.
+
+	2003-01-10  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* config/m68hc11/m68hc11.md ("*logicalsi3_silshl16_zext"): New split.
+	("*logicalsi3_silshr16"): Fix constraints.
+
+	2002-02-27  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* reload.c (find_reloads): Change to RELOAD_FOR_OTHER_ADDRESS any
+	RELOAD_FOR_OPERAND_ADDRESS reloads which is used by a RELOAD_FOR_OTHER
+	reload (ensures correct order of reload insns).
+
+	2001-07-09  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* reload1.c (merge_assigned_reloads): After a RELOAD_OTHER merge,
+	fix setting of the reloads of that reload to RELOAD_FOR_OTHER_ADDRESS.
+
+	2001-06-22  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* config/m68hc11/m68hc11.h (MAX_BITS_PER_WORD): Define to 32.
+
+	2001-03-01  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+	* reload1.c (merge_assigned_reloads): Change the type of the
+	reload to emit it at the good place after the merge.
+
+	2001-02-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+        * reload.c (find_reloads_subreg_address): Call find_reloads_address
+        with the same reload type.
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/collect2.c gcc-3.3.6-m68hc1x/gcc/collect2.c
--- gcc-3.3.6/gcc/collect2.c	Mon Dec  8 20:02:39 2003
+++ gcc-3.3.6-m68hc1x/gcc/collect2.c	Sat Nov  5 19:17:25 2005
@@ -74,6 +74,10 @@ Software Foundation, 59 Temple Place - S
 #undef REAL_STRIP_FILE_NAME
 #endif
 
+#ifdef WIN32
+# define USE_POPEN
+#endif
+
 /* If we cannot use a special method, use the ordinary one:
    run nm to find what symbols are present.
    In a cross-compiler, this means you need a cross nm,
@@ -444,7 +448,11 @@ handler (signo)
 #endif
 
   signal (signo, SIG_DFL);
+#ifndef WIN32
   kill (getpid (), signo);
+#else
+  exit(3);
+#endif
 }
 
 
@@ -2081,6 +2089,31 @@ scan_prog_file (prog_name, which_pass)
   if (nm_file_name == 0)
     fatal ("cannot find `nm'");
 
+#ifdef USE_POPEN
+  p = (char*) xmalloc (strlen (nm_file_name)
+                       + strlen (NM_FLAGS)
+                       + strlen (prog_name)
+                       + 10);
+  strcpy (p, nm_file_name);
+  strcat (p, " ");
+  if (NM_FLAGS[0] != '\0')
+    {
+      strcat (p, NM_FLAGS);
+      strcat (p, " ");
+    }
+  strcat (p, prog_name);
+  inf = popen (p, "r");
+  if (inf == NULL)
+    fatal_perror ("can't popen `%s'", p);
+
+  /* Trace if needed.  */
+  if (vflag)
+    fprintf (stderr, " %s\n", p);
+
+  free (p);
+  fflush (stdout);
+  fflush (stderr);
+#else
   nm_argv[argc++] = nm_file_name;
   if (NM_FLAGS[0] != '\0')
     nm_argv[argc++] = NM_FLAGS;
@@ -2142,6 +2175,7 @@ scan_prog_file (prog_name, which_pass)
 
   if (debug)
     fprintf (stderr, "\nnm output with constructors/destructors.\n");
+#endif
 
   /* Read each line of nm output.  */
   while (fgets (buf, sizeof buf, inf) != (char *) 0)
@@ -2215,7 +2249,11 @@ scan_prog_file (prog_name, which_pass)
   if (fclose (inf) != 0)
     fatal_perror ("fclose");
 
+#ifdef USE_POPEN
+  pclose (inf);
+#else
   do_wait (nm_file_name);
+#endif
 
   signal (SIGINT,  int_handler);
 #ifdef SIGQUIT
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/combine.c gcc-3.3.6-m68hc1x/gcc/combine.c
--- gcc-3.3.6/gcc/combine.c	Tue Jan 18 09:39:05 2005
+++ gcc-3.3.6-m68hc1x/gcc/combine.c	Sat Nov  5 19:17:25 2005
@@ -6553,7 +6553,7 @@ make_compound_operation (x, in_code)
      address, we stay there.  If we have a comparison, set to COMPARE,
      but once inside, go back to our default of SET.  */
 
-  next_code = (code == MEM || code == PLUS || code == MINUS ? MEM
+  next_code = (code == MEM /* SCz: || code == PLUS || code == MINUS */ ? MEM
 	       : ((code == COMPARE || GET_RTX_CLASS (code) == '<')
 		  && XEXP (x, 1) == const0_rtx) ? COMPARE
 	       : in_code == COMPARE ? SET : in_code);
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/divmod.c gcc-3.3.6-m68hc1x/gcc/config/divmod.c
--- gcc-3.3.6/gcc/config/divmod.c	Thu Nov 30 09:25:58 2000
+++ gcc-3.3.6-m68hc1x/gcc/config/divmod.c	Sat Nov  5 19:17:25 2005
@@ -1,4 +1,5 @@
-long udivmodsi4 ();
+extern unsigned long __udivmodsi4 (unsigned long num, unsigned long den,
+                                   unsigned long *mod);
 
 long
 __divsi3 (long a, long b)
@@ -18,7 +19,7 @@ __divsi3 (long a, long b)
       neg = !neg;
     }
 
-  res = udivmodsi4 (a, b, 0);
+  res = __udivmodsi4 (a, b, 0);
 
   if (neg)
     res = -res;
@@ -41,7 +42,7 @@ __modsi3 (long a, long b)
   if (b < 0)
     b = -b;
 
-  res = udivmodsi4 (a, b, 1);
+  __udivmodsi4 (a, b, (unsigned long*) &res);
 
   if (neg)
     res = -res;
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/m68hc11/m68hc11-crt0.S gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11-crt0.S
--- gcc-3.3.6/gcc/config/m68hc11/m68hc11-crt0.S	Wed Aug 14 09:32:52 2002
+++ gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11-crt0.S	Sat Nov  5 19:17:25 2005
@@ -79,7 +79,7 @@ _start:
 ;; 
 ;;	int __premain(void);
 ;; 
-	jsr	__premain
+	bsr	__premain
 	
 ;;
 ;; 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/m68hc11/m68hc11-protos.h gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11-protos.h
--- gcc-3.3.6/gcc/config/m68hc11/m68hc11-protos.h	Sat Apr 12 23:53:41 2003
+++ gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11-protos.h	Sun Jan 22 20:57:38 2006
@@ -1,5 +1,6 @@
 /* Prototypes for exported functions defined in m68hc11.c
-   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003,
+   2005, 2006 Free Software Foundation, Inc.
    Contributed by Stephane Carrez (stcarrez@nerim.fr)
 
 This file is part of GNU CC.
@@ -24,7 +25,7 @@ extern int m68hc11_override_options PARA
 extern int m68hc11_optimization_options PARAMS((int,int));
 extern void m68hc11_conditional_register_usage PARAMS((void));
 extern int hard_regno_mode_ok PARAMS((int, enum machine_mode));
-extern int m68hc11_hard_regno_rename_ok PARAMS((int, int));
+extern int m68hc11_hard_regno_rename_ok PARAMS((int, int, int));
 
 extern int m68hc11_total_frame_size PARAMS((void));
 extern int m68hc11_initial_frame_pointer_offset PARAMS((void));
@@ -105,6 +106,7 @@ extern int go_if_legitimate_address2 PAR
 extern int reg_or_indexed_operand PARAMS((rtx,enum machine_mode));
 extern int tst_operand PARAMS((rtx,enum machine_mode));
 extern int cmp_operand PARAMS((rtx,enum machine_mode));
+extern int nonimmediate_noinc_operand PARAMS((rtx,enum machine_mode));
 extern int memory_indexed_operand PARAMS((rtx, enum machine_mode));
 
 extern void m68hc11_split_logical PARAMS((enum machine_mode, int, rtx*));
@@ -147,6 +149,7 @@ extern void m68hc11_function_epilogue PA
 
 extern int m68hc11_is_far_symbol PARAMS((rtx));
 extern int m68hc11_is_trap_symbol PARAMS((rtx));
+extern int m68hc11_page0_symbol_p (rtx x);
 
 #endif /* TREE_CODE */
 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/m68hc11/m68hc11.c gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11.c
--- gcc-3.3.6/gcc/config/m68hc11/m68hc11.c	Sat Apr 12 23:53:41 2003
+++ gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11.c	Sun Jan 22 21:12:58 2006
@@ -1,21 +1,22 @@
 /* Subroutines for code generation on Motorola 68HC11 and 68HC12.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    Contributed by Stephane Carrez (stcarrez@nerim.fr)
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+GCC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
-GNU CC is distributed in the hope that it will be useful,
+GCC is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
+along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.
 
@@ -70,6 +71,7 @@ static int autoinc_mode PARAMS ((rtx));
 static int m68hc11_make_autoinc_notes PARAMS ((rtx*, void*));
 static int m68hc11_auto_inc_p PARAMS ((rtx));
 static tree m68hc11_handle_fntype_attribute PARAMS ((tree *, tree, tree, int, bool *));
+static tree m68hc11_handle_page0_attribute PARAMS ((tree *, tree, tree, int, bool *));
 const struct attribute_spec m68hc11_attribute_table[];
 
 void create_regs_rtx PARAMS ((void));
@@ -79,6 +81,7 @@ static void m68hc11_output_function_epil
 static void m68hc11_asm_out_constructor PARAMS ((rtx, int));
 static void m68hc11_asm_out_destructor PARAMS ((rtx, int));
 static void m68hc11_encode_section_info PARAMS((tree, int));
+static const char *m68hc11_strip_name_encoding (const char* str);
 
 /* Must be set to 1 to produce debug messages.  */
 int debug_m6811 = 0;
@@ -129,6 +132,16 @@ unsigned char m68hc11_reg_valid_for_inde
    This is 1 for 68HC11 and 0 for 68HC12.  */
 int m68hc11_sp_correction;
 
+#define ADDR_STRICT       0x01  /* Accept only registers in class A_REGS  */
+#define ADDR_INCDEC       0x02  /* Post/Pre inc/dec */
+#define ADDR_INDEXED      0x04  /* D-reg index */
+#define ADDR_OFFSET       0x08
+#define ADDR_INDIRECT     0x10  /* Accept (mem (mem ...)) for [n,X] */
+#define ADDR_CONST        0x20  /* Accept const and symbol_ref  */
+
+int m68hc11_addr_mode;
+int m68hc11_mov_addr_mode;
+
 /* Comparison operands saved by the "tstxx" and "cmpxx" expand patterns.  */
 rtx m68hc11_compare_op0;
 rtx m68hc11_compare_op1;
@@ -227,6 +240,9 @@ static int nb_soft_regs;
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO  m68hc11_encode_section_info
 
+#undef TARGET_STRIP_NAME_ENCODING
+#define TARGET_STRIP_NAME_ENCODING m68hc11_strip_name_encoding
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 int
@@ -264,6 +280,8 @@ m68hc11_override_options ()
       m68hc11_reg_valid_for_base[HARD_Z_REGNUM] = 1;
       m68hc11_sp_correction = 1;
       m68hc11_tmp_regs_class = D_REGS;
+      m68hc11_addr_mode = ADDR_OFFSET;
+      m68hc11_mov_addr_mode = 0;
       if (m68hc11_soft_reg_count == 0 && !TARGET_M6812)
 	m68hc11_soft_reg_count = "4";
     }
@@ -283,6 +301,10 @@ m68hc11_override_options ()
       m68hc11_reg_valid_for_index[HARD_D_REGNUM] = 1;
       m68hc11_sp_correction = 0;
       m68hc11_tmp_regs_class = TMP_REGS;
+      m68hc11_addr_mode = ADDR_INDIRECT | ADDR_OFFSET | ADDR_CONST
+        | (TARGET_AUTO_INC_DEC ? ADDR_INCDEC : 0);
+      m68hc11_mov_addr_mode = ADDR_OFFSET | ADDR_CONST
+        | (TARGET_AUTO_INC_DEC ? ADDR_INCDEC : 0);
       target_flags &= ~MASK_M6811;
       target_flags |= MASK_NO_DIRECT_MODE;
       if (m68hc11_soft_reg_count == 0)
@@ -316,7 +338,7 @@ m68hc11_conditional_register_usage ()
   /* For 68HC12, the Z register emulation is not necessary when the
      frame pointer is not used.  The frame pointer is eliminated and
      replaced by the stack register (which is a BASE_REG_CLASS).  */
-  if (TARGET_M6812 && flag_omit_frame_pointer && optimize)
+  if (TARGET_M6812 && flag_omit_frame_pointer && optimize && 0)
     {
       fixed_regs[HARD_Z_REGNUM] = 1;
     }
@@ -385,8 +407,9 @@ hard_regno_mode_ok (regno, mode)
 }
 
 int
-m68hc11_hard_regno_rename_ok (reg1, reg2)
+m68hc11_hard_regno_rename_ok (reg1, reg2, mode)
      int reg1, reg2;
+     int mode;
 {
   /* Don't accept renaming to Z register.  We will replace it to
      X,Y or D during machine reorg pass.  */
@@ -398,6 +421,11 @@ m68hc11_hard_regno_rename_ok (reg1, reg2
       && (D_REGNO_P (reg1) || X_REGNO_P (reg1)))
     return 0;
 
+  /* Don't rename D as if it holds a 8-bit value, the code will be
+     bigger.  */
+  if (mode == QImode && D_REGNO_P (reg1))
+    return 0;
+
   return 1;
 }
 
@@ -522,21 +550,25 @@ preferred_reload_class (operand, class)
    For 68hc11:  n,r    with n in [0..255] and r in A_REGS class
    For 68hc12:  n,r    no constraint on the constant, r in A_REGS class.  */
 static int
-register_indirect_p (operand, mode, strict)
-     rtx operand;
-     enum machine_mode mode;
-     int strict;
+register_indirect_p (rtx operand, enum machine_mode mode, int addr_mode)
 {
   rtx base, offset;
 
   switch (GET_CODE (operand))
     {
+    case MEM:
+      if ((addr_mode & ADDR_INDIRECT) && GET_MODE_SIZE (mode) <= 2)
+        return register_indirect_p (XEXP (operand, 0), mode,
+                                    addr_mode & (ADDR_STRICT | ADDR_OFFSET));
+      return 0;
+
     case POST_INC:
     case PRE_INC:
     case POST_DEC:
     case PRE_DEC:
-      if (TARGET_M6812 && TARGET_AUTO_INC_DEC)
-	return register_indirect_p (XEXP (operand, 0), mode, strict);
+      if (addr_mode & ADDR_INCDEC)
+	return register_indirect_p (XEXP (operand, 0), mode,
+                                    addr_mode & ADDR_STRICT);
       return 0;
 
     case PLUS:
@@ -548,36 +580,57 @@ register_indirect_p (operand, mode, stri
       if (GET_CODE (offset) == MEM)
 	return 0;
 
+      /* Indexed addressing mode with 2 registers.  */
+      if (GET_CODE (base) == REG && GET_CODE (offset) == REG)
+        {
+          if (!(addr_mode & ADDR_INDEXED))
+            return 0;
+
+          addr_mode &= ADDR_STRICT;
+          if (REGNO_OK_FOR_BASE_P2 (REGNO (base), addr_mode)
+              && REGNO_OK_FOR_INDEX_P2 (REGNO (offset), addr_mode))
+            return 1;
+
+          if (REGNO_OK_FOR_BASE_P2 (REGNO (offset), addr_mode)
+              && REGNO_OK_FOR_INDEX_P2 (REGNO (base), addr_mode))
+            return 1;
+
+          return 0;
+        }
+
+      if (!(addr_mode & ADDR_OFFSET))
+        return 0;
+
       if (GET_CODE (base) == REG)
 	{
-	  if (!VALID_CONSTANT_OFFSET_P (offset, mode))
+          if (!VALID_CONSTANT_OFFSET_P (offset, mode))
 	    return 0;
 
-	  if (strict == 0)
+	  if (!(addr_mode & ADDR_STRICT))
 	    return 1;
 
-	  return REGNO_OK_FOR_BASE_P2 (REGNO (base), strict);
+	  return REGNO_OK_FOR_BASE_P2 (REGNO (base), 1);
 	}
+
       if (GET_CODE (offset) == REG)
 	{
 	  if (!VALID_CONSTANT_OFFSET_P (base, mode))
 	    return 0;
 
-	  if (strict == 0)
+	  if (!(addr_mode & ADDR_STRICT))
 	    return 1;
 
-	  return REGNO_OK_FOR_BASE_P2 (REGNO (offset), strict);
+	  return REGNO_OK_FOR_BASE_P2 (REGNO (offset), 1);
 	}
       return 0;
 
     case REG:
-      return REGNO_OK_FOR_BASE_P2 (REGNO (operand), strict);
+      return REGNO_OK_FOR_BASE_P2 (REGNO (operand), addr_mode & ADDR_STRICT);
 
     case CONST_INT:
-      if (TARGET_M6811)
-        return 0;
-
-      return VALID_CONSTANT_OFFSET_P (operand, mode);
+      if (addr_mode & ADDR_CONST)
+        return VALID_CONSTANT_OFFSET_P (operand, mode);
+      return 0;
 
     default:
       return 0;
@@ -592,6 +645,7 @@ m68hc11_small_indexed_indirect_p (operan
      enum machine_mode mode;
 {
   rtx base, offset;
+  int addr_mode;
 
   if (GET_CODE (operand) == REG && reload_in_progress
       && REGNO (operand) >= FIRST_PSEUDO_REGISTER
@@ -611,7 +665,8 @@ m68hc11_small_indexed_indirect_p (operan
   if (PUSH_POP_ADDRESS_P (operand))
     return 1;
 
-  if (!register_indirect_p (operand, mode, reload_completed))
+  addr_mode = m68hc11_mov_addr_mode | (reload_completed ? ADDR_STRICT : 0);
+  if (!register_indirect_p (operand, mode, addr_mode))
     return 0;
 
   if (TARGET_M6812 && GET_CODE (operand) == PLUS
@@ -654,12 +709,21 @@ m68hc11_register_indirect_p (operand, mo
      rtx operand;
      enum machine_mode mode;
 {
+  int addr_mode;
+
+  if (GET_CODE (operand) == REG && reload_in_progress
+      && REGNO (operand) >= FIRST_PSEUDO_REGISTER
+      && reg_equiv_memory_loc[REGNO (operand)])
+    {
+      operand = reg_equiv_memory_loc[REGNO (operand)];
+      operand = eliminate_regs (operand, 0, NULL_RTX);
+    }
   if (GET_CODE (operand) != MEM)
     return 0;
 
   operand = XEXP (operand, 0);
-  return register_indirect_p (operand, mode,
-                              (reload_completed | reload_in_progress));
+  addr_mode = m68hc11_addr_mode | (reload_completed ? ADDR_STRICT : 0);
+  return register_indirect_p (operand, mode, addr_mode);
 }
 
 static int
@@ -668,6 +732,8 @@ go_if_legitimate_address_internal (opera
      enum machine_mode mode;
      int strict;
 {
+  int addr_mode;
+
   if (CONSTANT_ADDRESS_P (operand) && TARGET_M6812)
     {
       /* Reject the global variables if they are too wide.  This forces
@@ -677,7 +743,8 @@ go_if_legitimate_address_internal (opera
 
       return 1;
     }
-  if (register_indirect_p (operand, mode, strict))
+  addr_mode = m68hc11_addr_mode | (strict ? ADDR_STRICT : 0);
+  if (register_indirect_p (operand, mode, addr_mode))
     {
       return 1;
     }
@@ -930,6 +997,27 @@ cmp_operand (operand, mode)
   return general_operand (operand, mode);
 }
 
+/* Predicate for nonimmediate operands but which rejects the
+   auto-increment/decrement modes.  We must use this predicate
+   for operand 0 (and sometimes operand 1) when an insn can have
+   an operand that would create a RELOAD_OTHER in which a reload
+   part (RELOAD_FOR_OUTPUT_ADDRESS) could be created.  When this
+   happens, the RELOAD_FOR_OUTPUT_ADDRESS is emitted after the RELOAD_OTHER
+   and this will not be valid.  */
+int
+nonimmediate_noinc_operand (operand, mode)
+     rtx operand;
+     enum machine_mode mode;
+{
+  if (GET_CODE (operand) == MEM)
+    {
+      rtx addr = XEXP (operand, 0);
+      if (m68hc11_auto_inc_p (addr))
+	return 0;
+    }
+  return nonimmediate_operand (operand, mode);
+}
+
 int
 non_push_operand (operand, mode)
      rtx operand;
@@ -944,6 +1032,43 @@ non_push_operand (operand, mode)
 }
 
 int
+splitable_operand (operand, mode)
+     rtx operand;
+     enum machine_mode mode;
+{
+  if (general_operand (operand, mode) == 0)
+    return 0;
+
+  if (push_operand (operand, mode) == 1)
+    return 0;
+
+  /* Reject a (MEM (MEM X)) because the patterns that use non_push_operand
+     need to split such addresses to access the low and high part but it
+     is not possible to express a valid address for the low part.  */
+  if (mode != QImode && GET_CODE (operand) == MEM
+      && GET_CODE (XEXP (operand, 0)) == MEM)
+    return 0;
+  return 1;
+}
+
+int
+push_or_splitable_operand (operand, mode)
+     rtx operand;
+     enum machine_mode mode;
+{
+  if (general_operand (operand, mode) == 0)
+    return 0;
+
+  /* Reject a (MEM (MEM X)) because the patterns that use non_push_operand
+     need to split such addresses to access the low and high part but it
+     is not possible to express a valid address for the low part.  */
+  if (mode != QImode && GET_CODE (operand) == MEM
+      && GET_CODE (XEXP (operand, 0)) == MEM)
+    return 0;
+  return 1;
+}
+
+int
 reg_or_some_mem_operand (operand, mode)
      rtx operand;
      enum machine_mode mode;
@@ -951,6 +1076,7 @@ reg_or_some_mem_operand (operand, mode)
   if (GET_CODE (operand) == MEM)
     {
       rtx op = XEXP (operand, 0);
+      int addr_mode;
 
       if (symbolic_memory_operand (op, mode))
 	return 1;
@@ -958,10 +1084,20 @@ reg_or_some_mem_operand (operand, mode)
       if (IS_STACK_PUSH (operand))
 	return 1;
 
-      if (m68hc11_register_indirect_p (operand, mode))
-	return 1;
+      if (GET_CODE (operand) == REG && reload_in_progress
+          && REGNO (operand) >= FIRST_PSEUDO_REGISTER
+          && reg_equiv_memory_loc[REGNO (operand)])
+         {
+            operand = reg_equiv_memory_loc[REGNO (operand)];
+            operand = eliminate_regs (operand, 0, NULL_RTX);
+         }
+      if (GET_CODE (operand) != MEM)
+         return 0;
 
-      return 0;
+      operand = XEXP (operand, 0);
+      addr_mode = m68hc11_addr_mode | (reload_completed ? ADDR_STRICT : 0);
+      addr_mode &= ~ADDR_INDIRECT;
+      return register_indirect_p (operand, mode, addr_mode);
     }
 
   return register_operand (operand, mode);
@@ -987,18 +1123,23 @@ m68hc11_indirect_p (operand, mode)
      rtx operand;
      enum machine_mode mode;
 {
-  if (GET_CODE (operand) == MEM)
+  if (GET_CODE (operand) == MEM && GET_MODE (operand) == mode)
     {
       rtx op = XEXP (operand, 0);
+      int addr_mode;
+
+      if (m68hc11_page0_symbol_p (op))
+        return 1;
 
       if (symbolic_memory_operand (op, mode))
-	return 0;
+	return TARGET_M6812;
 
       if (reload_in_progress)
         return 1;
 
       operand = XEXP (operand, 0);
-      return register_indirect_p (operand, mode, reload_completed);
+      addr_mode = m68hc11_addr_mode | (reload_completed ? ADDR_STRICT : 0);
+      return register_indirect_p (operand, mode, addr_mode);
     }
   return 0;
 }
@@ -1234,6 +1375,31 @@ m68hc11_initialize_trampoline (tramp, fn
 
 /* Declaration of types.  */
 
+/* Handle an "tiny_data" attribute; arguments as in
+   struct attribute_spec.handler.  */
+static tree
+m68hc11_handle_page0_attribute (node, name, args, flags, no_add_attrs)
+     tree *node;
+     tree name;
+     tree args ATTRIBUTE_UNUSED;
+     int flags ATTRIBUTE_UNUSED;
+     bool *no_add_attrs;
+{
+  tree decl = *node;
+
+  if (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
+    {
+      DECL_SECTION_NAME (decl) = build_string (6, ".page0");
+    }
+  else
+    {
+      warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+      *no_add_attrs = true;
+    }
+
+  return NULL_TREE;
+}
+
 const struct attribute_spec m68hc11_attribute_table[] =
 {
   /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
@@ -1241,6 +1407,7 @@ const struct attribute_spec m68hc11_attr
   { "trap",      0, 0, false, true,  true,  m68hc11_handle_fntype_attribute },
   { "far",       0, 0, false, true,  true,  m68hc11_handle_fntype_attribute },
   { "near",      0, 0, false, true,  true,  m68hc11_handle_fntype_attribute },
+  { "page0",     0, 0, false, false, false, m68hc11_handle_page0_attribute },
   { NULL,        0, 0, false, false, false, NULL }
 };
 
@@ -1271,6 +1438,52 @@ m68hc11_handle_fntype_attribute (node, n
 
   return NULL_TREE;
 }
+/* Undo the effects of the above.  */
+
+static const char *
+m68hc11_strip_name_encoding (str)
+     const char *str;
+{
+  return str + (*str == '*' || *str == '@' || *str == '&');
+}
+
+static void
+m68hc11_encode_label (tree decl)
+{
+  const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+  int len = strlen (str);
+  char *newstr = alloca (len + 2);
+
+  newstr[0] = '@';
+  strcpy (&newstr[1], str);
+
+  XSTR (XEXP (DECL_RTL (decl), 0), 0) = ggc_alloc_string (newstr, len + 1);
+}
+
+/* Return 1 if this is a symbol in page0  */
+int
+m68hc11_page0_symbol_p (rtx x)
+{
+  switch (GET_CODE (x))
+    {
+    case SYMBOL_REF:
+      return XSTR (x, 0) != 0 && XSTR (x, 0)[0] == '@';
+
+    case CONST:
+      return m68hc11_page0_symbol_p (XEXP (x, 0));
+
+    case PLUS:
+      if (!m68hc11_page0_symbol_p (XEXP (x, 0)))
+        return 0;
+
+      return GET_CODE (XEXP (x, 1)) == CONST_INT
+        && INTVAL (XEXP (x, 1)) < 256
+        && INTVAL (XEXP (x, 1)) >= 0;
+
+    default:
+      return 0;
+    }
+}
 
 /* We want to recognize trap handlers so that we handle calls to traps
    in a special manner (by issuing the trap).  This information is stored
@@ -1286,6 +1499,13 @@ m68hc11_encode_section_info (decl, first
   int is_far = 0;
   rtx rtl;
   
+  if (TREE_CODE (decl) == VAR_DECL)
+    {
+      if (lookup_attribute ("page0", DECL_ATTRIBUTES (decl)) != 0)
+        m68hc11_encode_label (decl);
+      return;
+    }
+
   if (TREE_CODE (decl) != FUNCTION_DECL)
     return;
 
@@ -1372,15 +1592,19 @@ m68hc11_initial_elimination_offset (from
   /* For a trap handler, we must take into account the registers which
      are pushed on the stack during the trap (except the PC).  */
   func_attr = TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl));
+  current_function_interrupt = lookup_attribute ("interrupt",
+						 func_attr) != NULL_TREE;
+  trap_handler = lookup_attribute ("trap", func_attr) != NULL_TREE;
 
   if (lookup_attribute ("far", func_attr) != 0)
     current_function_far = 1;
   else if (lookup_attribute ("near", func_attr) != 0)
     current_function_far = 0;
   else
-    current_function_far = TARGET_LONG_CALLS != 0;
+    current_function_far = (TARGET_LONG_CALLS != 0
+                            && !current_function_interrupt
+                            && !trap_handler);
 
-  trap_handler = lookup_attribute ("trap", func_attr) != NULL_TREE;
   if (trap_handler && from == ARG_POINTER_REGNUM)
     size = 7;
 
@@ -1679,7 +1903,9 @@ expand_prologue ()
   else if (lookup_attribute ("near", func_attr) != NULL_TREE)
     current_function_far = 0;
   else
-    current_function_far = TARGET_LONG_CALLS != 0;
+    current_function_far = (TARGET_LONG_CALLS != 0
+                            && !current_function_interrupt
+                            && !current_function_trap);
 
   /* Get the scratch register to build the frame and push registers.
      If the first argument is a 32-bit quantity, the D+X registers
@@ -2014,6 +2240,14 @@ m68hc11_gen_highpart (mode, x)
 	{
 	  return gen_int_mode (val >> 16, HImode);
 	}
+      else if (mode == SImode)
+       {
+#if HOST_BITS_PER_WIDE_INT > 32
+         return gen_int_mode (val >> 32, SImode);
+#else
+         return (val >= 0) ? const0_rtx : constm1_rtx;
+#endif
+       }
     }
   if (mode == QImode && D_REG_P (x))
     return gen_rtx (REG, mode, HARD_A_REGNUM);
@@ -2307,7 +2541,21 @@ print_operand (file, op, letter)
 	    abort ();
 	  break;
 
+        case MEM:
+          if (TARGET_M6812)
+            {
+              fprintf (file, "[");
+              print_operand_address (file, XEXP (base, 0));
+              fprintf (file, "]");
+            }
+          else
+            abort ();
+          break;
+
 	default:
+          if (m68hc11_page0_symbol_p (base))
+            fprintf (file, "*");
+
 	  output_address (base);
 	  break;
 	}
@@ -2349,7 +2597,7 @@ print_operand (file, op, letter)
 }
 
 /* Returns true if the operand 'op' must be printed with parenthesis
-   arround it.  This must be done only if there is a symbol whose name
+   around it.  This must be done only if there is a symbol whose name
    is a processor register.  */
 static int
 must_parenthesize (op)
@@ -2903,15 +3151,7 @@ m68hc11_split_move (to, from, scratch)
   high_to = m68hc11_gen_highpart (mode, to);
 
   low_from = m68hc11_gen_lowpart (mode, from);
-  if (mode == SImode && GET_CODE (from) == CONST_INT)
-    {
-      if (INTVAL (from) >= 0)
-	high_from = const0_rtx;
-      else
-	high_from = constm1_rtx;
-    }
-  else
-    high_from = m68hc11_gen_highpart (mode, from);
+  high_from = m68hc11_gen_highpart (mode, from);
 
   if (offset)
     {
@@ -3104,26 +3344,8 @@ m68hc11_split_logical (mode, code, opera
   low[2] = m68hc11_gen_lowpart (mode, operands[2]);
 
   high[0] = m68hc11_gen_highpart (mode, operands[0]);
-
-  if (mode == SImode && GET_CODE (operands[1]) == CONST_INT)
-    {
-      if (INTVAL (operands[1]) >= 0)
-	high[1] = const0_rtx;
-      else
-	high[1] = constm1_rtx;
-    }
-  else
-    high[1] = m68hc11_gen_highpart (mode, operands[1]);
-
-  if (mode == SImode && GET_CODE (operands[2]) == CONST_INT)
-    {
-      if (INTVAL (operands[2]) >= 0)
-	high[2] = const0_rtx;
-      else
-	high[2] = constm1_rtx;
-    }
-  else
-    high[2] = m68hc11_gen_highpart (mode, operands[2]);
+  high[1] = m68hc11_gen_highpart (mode, operands[1]);
+  high[2] = m68hc11_gen_highpart (mode, operands[2]);
 
   low[3] = operands[3];
   high[3] = operands[3];
@@ -3236,10 +3458,13 @@ m68hc11_gen_movhi (insn, operands)
 
   if (TARGET_M6812)
     {
-      if (IS_STACK_PUSH (operands[0]) && H_REG_P (operands[1]))
+      rtx from = operands[1];
+      rtx to = operands[0];
+
+      if (IS_STACK_PUSH (to) && H_REG_P (from))
 	{
           cc_status = cc_prev_status;
-	  switch (REGNO (operands[1]))
+	  switch (REGNO (from))
 	    {
 	    case HARD_X_REGNUM:
 	    case HARD_Y_REGNUM:
@@ -3247,17 +3472,17 @@ m68hc11_gen_movhi (insn, operands)
 	      output_asm_insn ("psh%1", operands);
 	      break;
             case HARD_SP_REGNUM:
-              output_asm_insn ("sts\t-2,sp", operands);
+              output_asm_insn ("sts\t2,-sp", operands);
               break;
 	    default:
 	      abort ();
 	    }
 	  return;
 	}
-      if (IS_STACK_POP (operands[1]) && H_REG_P (operands[0]))
+      if (IS_STACK_POP (from) && H_REG_P (to))
 	{
           cc_status = cc_prev_status;
-	  switch (REGNO (operands[0]))
+	  switch (REGNO (to))
 	    {
 	    case HARD_X_REGNUM:
 	    case HARD_Y_REGNUM:
@@ -3278,17 +3503,6 @@ m68hc11_gen_movhi (insn, operands)
 	{
 	  if (SP_REG_P (operands[0]))
 	    output_asm_insn ("lds\t%1", operands);
-	  else if (0 /* REG_WAS_0 note is boggus;  don't rely on it.  */
-                   && !D_REG_P (operands[0])
-                   && GET_CODE (operands[1]) == CONST_INT
-                   && (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
-                   && find_reg_note (insn, REG_WAS_0, 0))
-            {
-              if (INTVAL (operands[1]) == 1)
-                output_asm_insn ("in%0", operands);
-              else
-                output_asm_insn ("de%0", operands);
-            }
 	  else
 	    output_asm_insn ("ld%0\t%1", operands);
 	}
@@ -3299,11 +3513,52 @@ m68hc11_gen_movhi (insn, operands)
 	  else
 	    output_asm_insn ("st%1\t%0", operands);
 	}
+
+      /* The 68hc12 does not support (MEM:HI (MEM:HI)) with the movw
+         instruction.  We have to use a scratch register as temporary location.
+         Trying to use a specific pattern or constrain failed.  */
+      else if (GET_CODE (to) == MEM && GET_CODE (XEXP (to, 0)) == MEM)
+        {
+          rtx ops[4];
+
+          ops[0] = to;
+          ops[2] = from;
+          ops[3] = 0;
+          if (dead_register_here (insn, d_reg))
+            ops[1] = d_reg;
+          else if (dead_register_here (insn, ix_reg))
+            ops[1] = ix_reg;
+          else if (dead_register_here (insn, iy_reg))
+            ops[1] = iy_reg;
+          else
+            {
+              ops[1] = d_reg;
+              ops[3] = d_reg;
+              output_asm_insn ("psh%3", ops);
+            }
+
+          ops[0] = to;
+          ops[2] = from;
+          output_asm_insn ("ld%1\t%2", ops);
+          output_asm_insn ("st%1\t%0", ops);
+          if (ops[3])
+            output_asm_insn ("pul%3", ops);
+        }
+
+      /* Use movw for non-null constants or when we are clearing
+         a volatile memory reference.  However, this is possible
+         only if the memory reference has a small offset or is an
+         absolute address.  */
+      else if (GET_CODE (from) == CONST_INT
+               && INTVAL (from) == 0
+               && (MEM_VOLATILE_P (to) == 0
+                   || m68hc11_small_indexed_indirect_p (to, HImode) == 0))
+        {
+          output_asm_insn ("clr\t%h0", operands);
+          output_asm_insn ("clr\t%b0", operands);
+        }
       else
 	{
-	  rtx from = operands[1];
-	  rtx to = operands[0];
-
 	  if ((m68hc11_register_indirect_p (from, GET_MODE (from))
 	       && !m68hc11_small_indexed_indirect_p (from, GET_MODE (from)))
 	      || (m68hc11_register_indirect_p (to, GET_MODE (to))
@@ -3320,6 +3575,7 @@ m68hc11_gen_movhi (insn, operands)
 		  ops[0] = to;
 		  ops[1] = operands[2];
 		  m68hc11_gen_movhi (insn, ops);
+                  return;
 		}
 	      else
 		{
@@ -3327,19 +3583,11 @@ m68hc11_gen_movhi (insn, operands)
                   fatal_insn ("move insn not handled", insn);
 		}
 	    }
-	  else
-	    {
-	      if (GET_CODE (from) == CONST_INT && INTVAL (from) == 0)
-		{
-		  output_asm_insn ("clr\t%h0", operands);
-		  output_asm_insn ("clr\t%b0", operands);
-		}
-	      else
-		{
-                  m68hc11_notice_keep_cc (operands[0]);
-		  output_asm_insn ("movw\t%1,%0", operands);
-		}
-	    }
+          else
+            {
+              m68hc11_notice_keep_cc (operands[0]);
+              output_asm_insn ("movw\t%1,%0", operands);
+            }
 	}
       return;
     }
@@ -3472,16 +3720,6 @@ m68hc11_gen_movhi (insn, operands)
 	      cc_status = cc_prev_status;
 	      output_asm_insn ("tsx", operands);
 	    }
-	  else if (0 /* REG_WAS_0 note is boggus;  don't rely on it.  */
-                   && GET_CODE (operands[1]) == CONST_INT
-                   && (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
-                   && find_reg_note (insn, REG_WAS_0, 0))
-            {
-              if (INTVAL (operands[1]) == 1)
-                output_asm_insn ("in%0", operands);
-              else
-                output_asm_insn ("de%0", operands);
-            }
 	  else
 	    {
 	      output_asm_insn ("ldx\t%1", operands);
@@ -3530,16 +3768,6 @@ m68hc11_gen_movhi (insn, operands)
 	      cc_status = cc_prev_status;
 	      output_asm_insn ("tsy", operands);
 	    }
-	  else if (0 /* REG_WAS_0 note is boggus;  don't rely on it.  */
-                   && GET_CODE (operands[1]) == CONST_INT
-                   && (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
-                   && find_reg_note (insn, REG_WAS_0, 0))
-            {
-              if (INTVAL (operands[1]) == 1)
-                output_asm_insn ("in%0", operands);
-              else
-                output_asm_insn ("de%0", operands);
-            }
           else
 	    {
 	      output_asm_insn ("ldy\t%1", operands);
@@ -3689,8 +3917,10 @@ m68hc11_gen_movqi (insn, operands)
 	}
       else if (H_REG_P (operands[0]))
 	{
-	  if (Q_REG_P (operands[0]))
-	    output_asm_insn ("lda%0\t%b1", operands);
+          if (IS_STACK_POP (operands[1]))
+            output_asm_insn ("pul%b0", operands);
+	  else if (Q_REG_P (operands[0]))
+            output_asm_insn ("lda%0\t%b1", operands);
 	  else if (D_REG_P (operands[0]))
 	    output_asm_insn ("ldab\t%b1", operands);
 	  else
@@ -3780,16 +4010,6 @@ m68hc11_gen_movqi (insn, operands)
 		  output_asm_insn ("ldab\t%T0", operands);
 		}
 	    }
-	  else if (0 /* REG_WAS_0 note is boggus;  don't rely on it.  */
-                   && GET_CODE (operands[1]) == CONST_INT
-                   && (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
-                   && find_reg_note (insn, REG_WAS_0, 0))
-            {
-              if (INTVAL (operands[1]) == 1)
-                output_asm_insn ("inc%b0", operands);
-              else
-                output_asm_insn ("dec%b0", operands);
-            }          
 	  else if (!DB_REG_P (operands[1]) && !D_REG_P (operands[1])
 		   && !DA_REG_P (operands[1]))
 	    {
@@ -3935,11 +4155,34 @@ m68hc11_gen_movqi (insn, operands)
 	  break;
 
 	case HARD_X_REGNUM:
-	  output_asm_insn ("xgdx\n\tstab\t%b0\n\txgdx", operands);
-	  break;
-
-	case HARD_Y_REGNUM:
-	  output_asm_insn ("xgdy\n\tstab\t%b0\n\txgdy", operands);
+        case HARD_Y_REGNUM:
+	  if (!reg_mentioned_p (operands[1], operands[0]))
+	    {
+              output_asm_insn ("xgd%1\n\tstab\t%b0\n\txgd%1", operands);
+            }
+          else if (TARGET_M6811)
+            {
+              int dead = dead_register_here (insn, d_reg);
+	      output_asm_insn ("st%1\t%t1", operands);
+              if (!dead)
+                output_asm_insn ("psha", operands);
+	      output_asm_insn ("ldaa\t%T1", operands);
+	      output_asm_insn ("staa\t%0", operands);
+              if (!dead)
+                output_asm_insn ("pula", operands);
+	      CC_STATUS_INIT;
+            }
+          else
+            {
+              int dead = dead_register_here (insn, d_reg);
+              if (!dead)
+                output_asm_insn ("psha", operands);
+	      output_asm_insn ("tfr\t%1,a", operands);
+	      output_asm_insn ("staa\t%0", operands);
+              if (!dead)
+                output_asm_insn ("pulb", operands);
+	      CC_STATUS_INIT;
+            }
 	  break;
 
 	default:
@@ -4136,6 +4379,12 @@ m68hc11_notice_update_cc (exp, insn)
       && cc_status.value2
       && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2))
     cc_status.value2 = 0;
+
+  else if (cc_status.value1 && side_effects_p (cc_status.value1))
+    cc_status.value1 = 0;
+
+  else if (cc_status.value2 && side_effects_p (cc_status.value2))
+    cc_status.value2 = 0;
 }
 
 /* The current instruction does not affect the flags but changes
@@ -4306,8 +4555,10 @@ m68hc11_check_z_replacement (insn, info)
 	{
 	  if ((GET_CODE (src) == REG && REGNO (src) == HARD_Z_REGNUM)
 	      || (GET_CODE (src) == COMPARE &&
-		  (rtx_equal_p (XEXP (src, 0), z_reg)
-		   || rtx_equal_p (XEXP (src, 1), z_reg))))
+		  ((rtx_equal_p (XEXP (src, 0), z_reg)
+                    && H_REG_P (XEXP (src, 1)))
+		   || (rtx_equal_p (XEXP (src, 1), z_reg)
+                       && H_REG_P (XEXP (src, 0))))))
 	    {
 	      if (insn == info->first)
 		{
@@ -4905,7 +5156,7 @@ m68hc11_find_z_replacement (insn, info)
 /* The insn uses the Z register.  Find a replacement register for it
    (either X or Y) and replace it in the insn and the next ones until
    the flow changes or the replacement register is used.  Instructions
-   are emited before and after the Z-block to preserve the value of
+   are emitted before and after the Z-block to preserve the value of
    Z and of the replacement register.  */
 
 static void
@@ -5067,9 +5318,11 @@ m68hc11_z_replacement (insn)
       if (info.save_before_last)
 	save_pos_insn = PREV_INSN (save_pos_insn);
 
-      emit_insn_before (gen_movhi (gen_rtx (REG, HImode, SOFT_Z_REGNUM),
-				   gen_rtx (REG, HImode, info.regno)),
-			save_pos_insn);
+      /* Use emit_insn_after () to ensure the new insn is part of
+         the good basic block.  */
+      emit_insn_after (gen_movhi (gen_rtx (REG, HImode, SOFT_Z_REGNUM),
+                                  gen_rtx (REG, HImode, info.regno)),
+                       PREV_INSN (save_pos_insn));
     }
 
   if (info.must_push_reg && info.last)
@@ -5108,8 +5361,8 @@ m68hc11_z_replacement (insn)
       else
 	dst = gen_rtx (REG, HImode, SOFT_SAVED_XY_REGNUM);
 
-      emit_insn_before (gen_movhi (gen_rtx (REG, HImode, info.regno),
-				   dst), insn);
+      emit_insn_after (gen_movhi (gen_rtx (REG, HImode, info.regno),
+                                  dst), PREV_INSN (insn));
     }
 
 }
@@ -5176,6 +5429,13 @@ m68hc11_reassign_regs (first)
 }
 
 
+/* Machine-dependent reorg pass.
+   Specific optimizations are defined here:
+    - this pass changes the Z register into either X or Y
+      (it preserves X/Y previous values in a memory slot in page0).
+
+   When this pass is finished, the global variable
+   'z_replacement_completed' is set to 2.  */
 void
 m68hc11_reorg (first)
      rtx first;
@@ -5204,7 +5464,7 @@ m68hc11_reorg (first)
   z_replacement_completed = 1;
   m68hc11_reassign_regs (first);
 
-  /* After some splitting, there are some oportunities for CSE pass.
+  /* After some splitting, there are some opportunities for CSE pass.
      This happens quite often when 32-bit or above patterns are split.  */
   if (optimize > 0 && split_done)
     {
@@ -5355,7 +5615,7 @@ m68hc11_address_cost (addr)
       break;
 
     case SYMBOL_REF:
-      cost = 8;
+      cost = m68hc11_page0_symbol_p (addr) ? 0 : 8;
       break;
 
     case LABEL_REF:
@@ -5388,7 +5648,7 @@ m68hc11_address_cost (addr)
 	    break;
 
 	  case SYMBOL_REF:
-	    cost = 8;
+	    cost = m68hc11_page0_symbol_p (addr) ? 0 : 8;
 	    break;
 
 	  case CONST:
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/m68hc11/m68hc11.h gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11.h
--- gcc-3.3.6/gcc/config/m68hc11/m68hc11.h	Tue Jul  8 23:07:33 2003
+++ gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11.h	Sun Jan 22 19:56:29 2006
@@ -1,22 +1,23 @@
 /* Definitions of target machine for GNU compiler.
    Motorola 68HC11 and 68HC12.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+   2005, 2006 Free Software Foundation, Inc.
    Contributed by Stephane Carrez (stcarrez@nerim.fr)
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+GCC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
-GNU CC is distributed in the hope that it will be useful,
+GCC is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
+along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.
 
@@ -52,7 +53,7 @@ Note:
 #endif
 
 /* We need to tell the linker the target elf format.  Just pass an
-   emulation option.  This can be overriden by -Wl option of gcc.  */
+   emulation option.  This can be overridden by -Wl option of gcc.  */
 #ifndef LINK_SPEC
 #define LINK_SPEC                                               \
 "%{m68hc12:-m m68hc12elf}"                                      \
@@ -277,6 +278,10 @@ extern const struct processor_costs *m68
 /* Define this if most significant word of a multiword number is numbered.  */
 #define WORDS_BIG_ENDIAN 	1
 
+/* Use a MAX_BITS_PER_WORD equivalent to SImode so that
+   several SI patterns can be used (mostly shift & add).  */
+/* #define MAX_BITS_PER_WORD       32  */
+
 /* Width of a word, in units (bytes).  */
 #define UNITS_PER_WORD		2
 
@@ -804,8 +809,8 @@ extern enum reg_class m68hc11_tmp_regs_c
 /* A C expression that is nonzero if hard register number REGNO2 can be
    considered for use as a rename register for REGNO1 */
 
-#define HARD_REGNO_RENAME_OK(REGNO1,REGNO2) \
-  m68hc11_hard_regno_rename_ok ((REGNO1), (REGNO2))
+#define HARD_REGNO_RENAME_OK(REGNO1,REGNO2,MODE)            \
+  m68hc11_hard_regno_rename_ok ((REGNO1), (REGNO2), (MODE))
 
 /* A C expression whose value is nonzero if pseudos that have been
    assigned to registers of class CLASS would likely be spilled
@@ -874,7 +879,9 @@ extern enum reg_class m68hc11_tmp_regs_c
 		 && VALUE == CONST0_RTX (GET_MODE (VALUE))) : 0) 
 
 /* 'U' represents certain kind of memory indexed operand for 68HC12.
-   and any memory operand for 68HC11.  */
+   and any memory operand for 68HC11.
+   'R' represents indexed addressing mode or access to page0 for 68HC11.
+   For 68HC12, it represents any memory operand.  */
 #define EXTRA_CONSTRAINT(OP, C)                         \
 ((C) == 'U' ? m68hc11_small_indexed_indirect_p (OP, GET_MODE (OP)) \
  : (C) == 'Q' ? m68hc11_symbolic_p (OP, GET_MODE (OP)) \
@@ -963,7 +970,7 @@ extern enum reg_class m68hc11_tmp_regs_c
    followed by "to".  Eliminations of the same "from" register are listed
    in order of preference.
 
-   We have two registers that are eliminated on the 6811. The psuedo arg
+   We have two registers that are eliminated on the 6811. The pseudo arg
    pointer and pseudo frame pointer registers can always be eliminated;
    they are replaced with either the stack or the real frame pointer.  */
 
@@ -1215,7 +1222,7 @@ extern enum reg_class m68hc11_index_reg_
 
 
 /* Internal macro, return 1 if REGNO is a valid base register.  */
-#define REG_VALID_P(REGNO) (1)	/* ? */
+#define REG_VALID_P(REGNO) ((REGNO) >= 0)
 
 extern unsigned char m68hc11_reg_valid_for_base[FIRST_PSEUDO_REGISTER];
 #define REG_VALID_FOR_BASE_P(REGNO) \
@@ -1489,7 +1496,7 @@ extern unsigned char m68hc11_reg_valid_f
    macro is used in only one place: `find_reloads_address' in reload.c.
 
    For M68HC11, we handle large displacements of a base register
-   by splitting the addend accors an addhi3 insn.
+   by splitting the addend across an addhi3 insn.
 
    For M68HC12, the 64K offset range is available.
    */
@@ -1690,7 +1697,7 @@ do {                                    
 
 /* Assembler Commands for Exception Regions.  */
 
-/* Default values provided by GCC should be ok. Assumming that DWARF-2
+/* Default values provided by GCC should be ok. Assuming that DWARF-2
    frame unwind info is ok for this platform.  */
 
 #undef PREFERRED_DEBUGGING_TYPE
@@ -1719,6 +1726,12 @@ do {                                    
 #define IMMEDIATE_PREFIX "#"
 #define GLOBAL_ASM_OP   "\t.globl\t"
 
+/* This is how to output a reference to a user-level label named NAME.
+   `assemble_name' uses this.  */
+#undef  ASM_OUTPUT_LABELREF
+#define ASM_OUTPUT_LABELREF(FILE, NAME) \
+  asm_fprintf (FILE, "%U%s", (*targetm.strip_name_encoding) (NAME))
+
 
 /* Miscellaneous Parameters.  */
 
@@ -1737,8 +1750,10 @@ do {                                    
 {"m68hc11_shift_operator",   {ASHIFT, ASHIFTRT, LSHIFTRT, ROTATE, ROTATERT}},\
 {"m68hc11_eq_compare_operator", {EQ, NE}},                              \
 {"non_push_operand",         {SUBREG, REG, MEM}},			\
+{"splitable_operand",        {SUBREG, REG, MEM}},			\
 {"reg_or_some_mem_operand",  {SUBREG, REG, MEM}},			\
 {"tst_operand",              {SUBREG, REG, MEM}},			\
+{"nonimmediate_noinc_operand", {SUBREG, REG, MEM}},			\
 {"cmp_operand",              {SUBREG, REG, MEM, SYMBOL_REF, LABEL_REF,	\
 			     CONST_INT, CONST_DOUBLE}},
 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/m68hc11/m68hc11.md gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11.md
--- gcc-3.3.6/gcc/config/m68hc11/m68hc11.md	Sat Apr 12 23:25:37 2003
+++ gcc-3.3.6-m68hc1x/gcc/config/m68hc11/m68hc11.md	Sun Jan 22 21:06:16 2006
@@ -1,21 +1,22 @@
 ;;- Machine description file for Motorola 68HC11 and 68HC12.
-;;- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+;;- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+;;- Free Software Foundation, Inc.
 ;;- Contributed by Stephane Carrez (stcarrez@nerim.fr)
 
-;; This file is part of GNU CC.
+;; This file is part of GCC.
 
-;; GNU CC is free software; you can redistribute it and/or modify
+;; GCC is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
-;; GNU CC is distributed in the hope that it will be useful,
+;; GCC is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU CC; see the file COPYING.  If not, write to
+;; along with GCC; see the file COPYING.  If not, write to
 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
@@ -93,7 +94,7 @@
 ;; Operands modifiers:
 ;;
 ;;     %b	Get the low part of the operand (to obtain a QImode)
-;;		This modified must always be used for QImode operations
+;;		This modifier must always be used for QImode operations
 ;;		because a correction must be applied when the operand
 ;;		is a soft register (ex: *ZD1). Otherwise, we generate
 ;;		*ZD1 and this is the high part of the register. For other
@@ -143,7 +144,9 @@
    (A_REGNUM        5)		; A (high part of D)
    (B_REGNUM        6)		; B (low part of D)
    (CC_REGNUM       7)		; Condition code register
-   (SOFT_Z_REGNUM  11)          ; Z soft register
+   (SOFT_TMP_REGNUM 10)         ; TMP soft register
+   (SOFT_Z_REGNUM   11)         ; Z soft register
+   (SOFT_XY_REGNUM  12)         ; XY soft register
 ])
 
 ;;--------------------------------------------------------------------
@@ -247,19 +250,13 @@
 ;; avoid problems with the flow+cse register pass which are made
 ;; after Z register replacement.
 ;;
-(define_insn "tstqi_z_used"
+(define_insn_and_split "tstqi_z_used"
   [(set (cc0)
 	(match_operand:QI 0 "tst_operand" "m"))
    (use (match_operand:HI 1 "hard_reg_operand" "dxy"))
-   (use (reg:HI 11))]
-  ""
-  "#")
-
-(define_split /* "tstqi_z_used" */
-  [(set (cc0)
-	(match_operand:QI 0 "tst_operand" ""))
-   (use (match_operand:HI 1 "hard_reg_operand" ""))
    (use (reg:HI SOFT_Z_REGNUM))]
+  ""
+  "#"
   "z_replacement_completed == 2"
   [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM))) (match_dup 1))
    (set (match_dup 1) (match_dup 2))
@@ -300,12 +297,24 @@
   [(set (cc0)
 	(compare (match_operand:HI 0 "hard_reg_operand" "")
 		 (match_operand:HI 1 "hard_reg_operand" "")))]
-  "reload_completed"
+  "TARGET_M6811
+   && reload_completed && !(Z_REG_P (operands[0]) || Z_REG_P (operands[1]))"
   [(set (match_dup 2) (match_dup 1))
    (set (cc0)
         (compare (match_dup 0) (match_dup 2)))]
   "operands[2] = gen_rtx (REG, HImode, SOFT_TMP_REGNUM);")
 
+(define_split
+  [(set (cc0)
+	(compare (match_operand:HI 0 "hard_reg_operand" "")
+		 (match_operand:HI 1 "hard_reg_operand" "")))]
+  "0 && TARGET_M6812
+   && reload_completed && !(Z_REG_P (operands[0]) || Z_REG_P (operands[1]))"
+  [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM))) (match_dup 1))
+   (set (cc0)
+        (compare (match_dup 0) (mem:HI (post_inc:HI (reg:HI SP_REGNUM)))))]
+  "")
+
 (define_expand "cmphi"
   [(set (cc0)
 	(compare (match_operand:HI 0 "tst_operand" "")
@@ -325,7 +334,7 @@
   [(set (cc0)
 	(compare (match_operand:HI 0 "tst_operand" 
 				"d,?xy,xyd,?xy,d,m,!u,dxy,dxy")
-		 (match_operand:HI 1 "cmp_operand"
+		 (match_operand:HI 1 "general_operand"
 				"i,i,!u,m,m,dxy,dxy,?*d*A,!*w")))]
   "TARGET_M6812"
   "*
@@ -335,8 +344,10 @@
       cc_status.flags |= CC_REVERSED;
       return \"cp%1\\t%0\";
     }
+  else if (SP_REG_P (operands[1]))
+    return \"sts\\t2,-sp\n\\tcp%0\\t2,sp+\";
   else if (H_REG_P (operands[1]))
-    return \"#\";
+    return \"psh%1\n\\tcp%0\\t2,sp+\";
   else
     return \"cp%0\\t%1\";
 }")
@@ -344,9 +355,9 @@
 (define_insn "cmphi_1_hc11"
   [(set (cc0)
 	(compare (match_operand:HI 0 "tst_operand" 
-				"dx,y,xyd,?xy,d,m,!u,dxy,dxy")
+				"dx,y,xyd,?xy,d,m,m,dxy,dxy,?u*z,dxy,*z")
 		 (match_operand:HI 1 "cmp_operand"
-				"i,i,!u,m,m,dxy,dxy,?*d*A,!*w")))]
+				"i,i,!u,m,m,?xy,d,?*d*A,?u,dxy,!*w,i")))]
   "TARGET_M6811"
   "*
 {
@@ -361,21 +372,14 @@
     return \"cp%0\\t%1\";
 }")
 
-(define_insn "cmphi_z_used"
+(define_insn_and_split "cmphi_z_used"
   [(set (cc0)
 	(compare (match_operand:HI 0 "tst_operand" "dxy,m")
-		 (match_operand:HI 1 "cmp_operand" "m,dxy")))
+		 (match_operand:HI 1 "cmp_operand" "mi,dxy")))
    (use (match_operand:HI 2 "hard_reg_operand" "dxy,dxy"))
    (use (reg:HI SOFT_Z_REGNUM))]
   ""
-  "#")
-  
-(define_split /* "cmphi_z_used" */
-  [(set (cc0)
-	(compare (match_operand:HI 0 "tst_operand" "")
-		 (match_operand:HI 1 "cmp_operand" "")))
-   (use (match_operand:HI 2 "hard_reg_operand" ""))
-   (use (reg:HI SOFT_Z_REGNUM))]
+  "#"
   "z_replacement_completed == 2"
   [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM))) (match_dup 2))
    (set (match_dup 2) (match_dup 3))
@@ -452,21 +456,14 @@
    operands[3] = gen_rtx (REG, HImode, SOFT_TMP_REGNUM);
    operands[4] = gen_rtx (REG, QImode, SOFT_TMP_REGNUM);")
 
-(define_insn "bitcmpqi_z_used"
+(define_insn_and_split "bitcmpqi_z_used"
   [(set (cc0)
 	(and:QI (match_operand:QI 0 "tst_operand" "d,m")
 		(match_operand:QI 1 "cmp_operand" "m,d")))
    (use (match_operand:HI 2 "hard_reg_operand" "xy,xy"))
    (use (reg:HI SOFT_Z_REGNUM))]
   ""
-  "#")
-  
-(define_split /* "bitcmpqi_z_used" */
-  [(set (cc0)
-	(and:QI (match_operand:QI 0 "tst_operand" "")
-		(match_operand:QI 1 "cmp_operand" "")))
-   (use (match_operand:HI 2 "hard_reg_operand" ""))
-   (use (reg:HI SOFT_Z_REGNUM))]
+  "#"
   "z_replacement_completed == 2"
   [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM))) (match_dup 2))
    (set (match_dup 2) (match_dup 3))
@@ -542,21 +539,14 @@
    return \"cmpb\\t%b0\";
 }")
 
-(define_insn "cmpqi_z_used"
+(define_insn_and_split "cmpqi_z_used"
   [(set (cc0)
 	(compare (match_operand:QI 0 "tst_operand" "dxy,m")
 		 (match_operand:QI 1 "cmp_operand" "m,dxy")))
    (use (match_operand:HI 2 "hard_reg_operand" "dxy,dxy"))
    (use (reg:HI SOFT_Z_REGNUM))]
   ""
-  "#")
-  
-(define_split /* cmpqi_z_used */
-  [(set (cc0)
-	(compare (match_operand:QI 0 "tst_operand" "")
-		 (match_operand:QI 1 "cmp_operand" "")))
-   (use (match_operand:HI 2 "hard_reg_operand" ""))
-   (use (reg:HI SOFT_Z_REGNUM))]
+  "#"
   "z_replacement_completed == 2"
   [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM))) (match_dup 2))
    (set (match_dup 2) (match_dup 3))
@@ -573,41 +563,29 @@
 ;; (strict_low_part ...) information.  This is correct for our machine
 ;; description but not for GCC optimization passes.
 ;;
-(define_insn "movstrictsi"
+(define_insn_and_split "movstrictsi"
   [(set (strict_low_part (match_operand:SI 0 "non_push_operand" "+um,D,D"))
 	(match_operand:SI 1 "general_operand" "D,Dim,uD"))]
   ""
-  "#")
-
-(define_split
-  [(set (strict_low_part (match_operand:SI 0 "non_push_operand" ""))
-	(match_operand:SI 1 "general_operand" ""))]
+  "#"
   "z_replacement_completed == 2"
   [(set (match_dup 0) (match_dup 1))]
   "")
 
-(define_insn "movstricthi"
+(define_insn_and_split "movstricthi"
   [(set (strict_low_part (match_operand:HI 0 "non_push_operand" "+um,dA,dA"))
 	(match_operand:HI 1 "general_operand" "dA,dAim,u"))]
   ""
-  "#")
-
-(define_split
-  [(set (strict_low_part (match_operand:HI 0 "non_push_operand" ""))
-	(match_operand:HI 1 "general_operand" ""))]
+  "#"
   "z_replacement_completed == 2"
   [(set (match_dup 0) (match_dup 1))]
   "")
 
-(define_insn "movstrictqi"
+(define_insn_and_split "movstrictqi"
   [(set (strict_low_part (match_operand:QI 0 "non_push_operand" "+mu,!dA"))
 	(match_operand:QI 1 "general_operand" "d,imudA"))]
   ""
-  "#")
-
-(define_split
-  [(set (strict_low_part (match_operand:QI 0 "non_push_operand" ""))
-	(match_operand:QI 1 "general_operand" ""))]
+  "#"
   "z_replacement_completed == 2"
   [(set (match_dup 0) (match_dup 1))]
   "")
@@ -651,17 +629,26 @@
     }
 ")
 
-(define_insn "movdi_internal"
-  [(set (match_operand:DI 0 "nonimmediate_operand" "=ou,U,!u,U,m,m,!u")
+;; Separate push from normal moves to avoid reloading problems
+;; The 'clr' is not able to push on 68HC11 so we really need a scratch.
+;; We can also accept more scratch registers.
+(define_insn_and_split "*pushdi_internal"
+  [(set (match_operand:DI 0 "push_operand" "=<,<,<,<")
+	(match_operand:DI 1 "general_operand" "i,U,m,!u"))
+   (clobber (match_scratch:HI 2 "=&dA,&d,&d,&dA"))]
+  ""
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_move (operands[0], operands[1], operands[2]);
+   DONE;")
+
+(define_insn_and_split "movdi_internal"
+  [(set (match_operand:DI 0 "non_push_operand" "=m!u,U,!u,U,m,m,!u")
 	(match_operand:DI 1 "general_operand" "K,iU,iU,!u,mi,!u,!mu"))
    (clobber (match_scratch:HI 2 "=X,&d,&d,&d,&d,&d,&d"))]
   ""
-  "#")
-
-(define_split
-  [(set (match_operand:DI 0 "nonimmediate_operand" "")
-	(match_operand:DI 1 "general_operand" ""))
-   (clobber (match_scratch:HI 2 ""))]
+  "#"
   "reload_completed"
   [(const_int 0)]
   "m68hc11_split_move (operands[0], operands[1], operands[2]);
@@ -687,17 +674,24 @@
     }
 ")
 
-(define_insn "movdf_internal"
-  [(set (match_operand:DF 0 "nonimmediate_operand" "=ou,U,!u,U,m,m,!u")
+;; See pushdi_internal
+(define_insn_and_split "*pushdf_internal"
+  [(set (match_operand:DF 0 "push_operand" "=<,<,<,<")
+	(match_operand:DF 1 "general_operand" "i,U,m,!u"))
+   (clobber (match_scratch:HI 2 "=&dA,&d,&d,&dA"))]
+  ""
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_move (operands[0], operands[1], operands[2]);
+   DONE;")
+
+(define_insn_and_split "movdf_internal"
+  [(set (match_operand:DF 0 "non_push_operand" "=mu,U,!u,U,m,m,!u")
 	(match_operand:DF 1 "general_operand" "G,iU,iU,!u,mi,!u,!mu"))
    (clobber (match_scratch:HI 2 "=X,&d,&d,&d,&d,&d,&d"))]
   ""
-  "#")
-
-(define_split
-  [(set (match_operand:DF 0 "nonimmediate_operand" "")
-	(match_operand:DF 1 "general_operand" ""))
-   (clobber (match_scratch:HI 2 ""))]
+  "#"
   "reload_completed"
   [(const_int 0)]
   "m68hc11_split_move (operands[0], operands[1], operands[2]);
@@ -732,17 +726,23 @@
     }
 ")
 
-(define_insn "movsi_internal"
-  [(set (match_operand:SI 0 "nonimmediate_operand" "=ou,mu,?D,m,?D,?u,?u,!u,D")
-	(match_operand:SI 1 "general_operand"      "K,imu,im,?D,!u,?D,mi,!u,!D"))
-   (clobber (match_scratch:HI 2                    "=X,&d,X,X,X,X,&d,&d,X"))]
+(define_insn_and_split "*pushsi_internal"
+  [(set (match_operand:SI 0 "push_operand" "=<,<,<,<,<")
+	(match_operand:SI 1 "general_operand" "!D,i,U,m,!u"))
+   (clobber (match_scratch:HI 2 "=X,&dA,&d,&d,&dA"))]
   ""
-  "#")
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_move (operands[0], operands[1], operands[2]);
+   DONE;")
 
-(define_split
-  [(set (match_operand:SI 0 "nonimmediate_operand" "")
-	(match_operand:SI 1 "general_operand" ""))
-   (clobber (match_scratch:HI 2 ""))]
+(define_insn_and_split "movsi_internal"
+  [(set (match_operand:SI 0 "nonimmediate_operand" "=mu,mu,?D,m,?D,?u,?u,!u,D")
+	(match_operand:SI 1 "general_operand" "K,imu,im,?D,!u,?D,mi,!u,!D"))
+   (clobber (match_scratch:HI 2               "=X,&d,X,X,X,X,&d,&d,X"))]
+  ""
+  "#"
   "reload_completed"
   [(const_int 0)]
   "m68hc11_split_move (operands[0], operands[1], operands[2]);
@@ -768,17 +768,23 @@
     }
 ")
 
-(define_insn "movsf_internal"
-  [(set (match_operand:SF 0 "nonimmediate_operand" "=o!u,m,D,m,D,!u,!u,!u,D")
+(define_insn_and_split "*pushsf_internal"
+  [(set (match_operand:SF 0 "push_operand" "=<,<,<,<,<")
+	(match_operand:SF 1 "general_operand" "!D,i,U,m,!u"))
+   (clobber (match_scratch:HI 2 "=X,&dA,&d,&d,&dA"))]
+  ""
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_move (operands[0], operands[1], operands[2]);
+   DONE;")
+
+(define_insn_and_split "movsf_internal"
+  [(set (match_operand:SF 0 "nonimmediate_operand" "=m!u,m,D,m,D,!u,!u,!u,D")
 	(match_operand:SF 1 "general_operand" "G,im,im,D,!u,D,mi,!u,!D"))
    (clobber (match_scratch:HI 2 "=X,&d,X,X,X,X,&d,&d,X"))]
   ""
-  "#")
-
-(define_split
-  [(set (match_operand:SF 0 "nonimmediate_operand" "")
-	(match_operand:SF 1 "general_operand" ""))
-   (clobber (match_scratch:HI 2 ""))]
+  "#"
   "reload_completed"
   [(const_int 0)]
   "m68hc11_split_move (operands[0], operands[1], operands[2]);
@@ -849,6 +855,18 @@
           DONE;
         }
     }
+
+  /* The doloop optimization can emit a move with a constant > 32767.
+     This will fail later on because the move instruction is not recognized
+     eg: (set (reg:HI 53) (const_int 0x8000))
+     because for some reason gcc expects the constant to be sign extended
+     ie, it only recognize: (set (reg:HI 53) (const_int 0xffff8000))
+     Do the sign extension here.  */
+  if (GET_CODE (operands[1]) == CONST_INT
+      && INTVAL (operands[1]) > 0x7fffL && INTVAL (operands[1]) <= 0x0ffffL)
+    {
+      operands[1] = GEN_INT ((INTVAL (operands[1])) | (-1L << 16));
+    }
   if (TARGET_M6811 && (reload_in_progress | reload_completed) == 0)
     {
       if (GET_CODE (operands[0]) == MEM &&
@@ -878,18 +896,9 @@
     }
 }")
 
-(define_insn "movhi_const0"
-  [(set (match_operand:HI 0 "non_push_operand" "=d,A,um")
-	(const_int 0))]
-  ""
-  "@
-   clra\\n\\tclrb
-   ld%0\\t#0
-   clr\\t%b0\\n\\tclr\\t%h0")
-
 (define_insn "*movhi_68hc12"
-  [(set (match_operand:HI 0 "nonimmediate_operand" "=U,dAw,U,U,m,!u")
-	(match_operand:HI 1 "general_operand" "U,rim,dAwi,!u,dAw,riU"))]
+  [(set (match_operand:HI 0 "nonimmediate_operand" "=U,dAw,dAw,m,U,U,m,!u")
+	(match_operand:HI 1 "general_operand" "U,dAwim,!u,K,dAwi,!u,dAw,riU"))]
   "TARGET_M6812"
   "*
 {
@@ -897,6 +906,15 @@
   return \"\";
 }")
 
+(define_insn "movhi_const0"
+  [(set (match_operand:HI 0 "nonimmediate_operand" "=d,A,um")
+	(const_int 0))]
+  "TARGET_M6811"
+  "@
+   clra\\n\\tclrb
+   ld%0\\t#0
+   clr\\t%b0\\n\\tclr\\t%h0")
+
 (define_insn "*movhi_m68hc11"
   [(set (match_operand:HI 0 "nonimmediate_operand" "=dAw,!u,m,m,dAw,!*u")
 	(match_operand:HI 1 "general_operand" "dAwim,dAw,dA,?Aw,!*u,dAw"))]
@@ -936,9 +954,9 @@
 (define_split
   [(set (match_operand:QI 0 "hard_addr_reg_operand" "")
         (match_operand:QI 1 "general_operand" ""))]
-  "z_replacement_completed == 2 && GET_MODE (operands[0]) == QImode
+  "z_replacement_completed == 2
    && !reg_mentioned_p (operands[0], operands[1])
-   && !D_REG_P (operands[1])"
+   && !(D_REG_P (operands[1]) || Q_REG_P (operands[1]))"
   [(parallel [(set (reg:HI D_REGNUM) (match_dup 2))
               (set (match_dup 2) (reg:HI D_REGNUM))])
    (set (reg:QI D_REGNUM) (match_dup 1))
@@ -952,9 +970,9 @@
 (define_split
   [(set (match_operand:QI 0 "nonimmediate_operand" "")
         (match_operand:QI 1 "hard_addr_reg_operand" ""))]
-  "z_replacement_completed == 2 && GET_MODE (operands[1]) == QImode
+  "z_replacement_completed == 2
    && !reg_mentioned_p (operands[1], operands[0])
-   && !D_REG_P (operands[0])"
+   && !(D_REG_P (operands[0]) || Q_REG_P (operands[0]))"
   [(parallel [(set (reg:HI D_REGNUM) (match_dup 2))
               (set (match_dup 2) (reg:HI D_REGNUM))])
    (set (match_dup 0) (reg:QI D_REGNUM))
@@ -1664,8 +1682,8 @@
 ;;- Min and Max instructions (68HC12).
 ;;--------------------------------------------------------------------
 (define_insn "uminqi3"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=d,m")
-	(umin:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
+  [(set (match_operand:QI 0 "nonimmediate_noinc_operand" "=d,m")
+	(umin:QI (match_operand:QI 1 "nonimmediate_noinc_operand" "%0,0")
 		 (match_operand:QI 2 "general_operand" "m,d")))]
   "TARGET_M6812 && TARGET_MIN_MAX"
   "*
@@ -1686,8 +1704,8 @@
 }")
 
 (define_insn "umaxqi3"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=d,m")
-	(umax:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
+  [(set (match_operand:QI 0 "nonimmediate_noinc_operand" "=d,m")
+	(umax:QI (match_operand:QI 1 "nonimmediate_noinc_operand" "%0,0")
 		 (match_operand:QI 2 "general_operand" "m,d")))]
   "TARGET_M6812 && TARGET_MIN_MAX"
   "*
@@ -1708,8 +1726,8 @@
 }")
 
 (define_insn "uminhi3"
-  [(set (match_operand:HI 0 "nonimmediate_operand" "=d,m")
-	(umin:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
+  [(set (match_operand:HI 0 "nonimmediate_noinc_operand" "=d,m")
+	(umin:HI (match_operand:HI 1 "nonimmediate_noinc_operand" "%0,0")
 		 (match_operand:HI 2 "general_operand" "m,d")))]
   "TARGET_M6812 && TARGET_MIN_MAX"
   "*
@@ -1727,8 +1745,8 @@
 }")
 
 (define_insn "umaxhi3"
-  [(set (match_operand:HI 0 "nonimmediate_operand" "=d,m")
-	(umax:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
+  [(set (match_operand:HI 0 "nonimmediate_noinc_operand" "=d,m")
+	(umax:HI (match_operand:HI 1 "nonimmediate_noinc_operand" "%0,0")
 		 (match_operand:HI 2 "general_operand" "m,d")))]
   "TARGET_M6812 && TARGET_MIN_MAX"
   "*
@@ -2090,8 +2108,8 @@
 }")
 
 (define_insn "*addhi3_68hc12"
-  [(set (match_operand:HI 0 "register_operand" "=xyd,d,xy*z*w,xy*z*w,xy*z")
-        (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,xy*zw,0")
+  [(set (match_operand:HI 0 "register_operand" "=d*A,d,xy*A*w,xy*A*w,xy*A")
+        (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,xy*Aw,0")
                  (match_operand:HI 2 "general_operand" "i,m*A*wu,id,id,!mu*A")))]
   "TARGET_M6812"
   "*
@@ -2279,9 +2297,9 @@
 }")
 
 (define_insn "*addhi3"
-  [(set (match_operand:HI 0 "hard_reg_operand" "=A,dA,d,!A,d*A,!d*A")
-	(plus:HI (match_operand:HI 1 "general_operand" "%0,0,0,0,0,0")
-		 (match_operand:HI 2 "general_operand" "N,I,i,I,mi*A*d,!u*d*w")))]
+  [(set (match_operand:HI 0 "hard_reg_operand" "=A,dA,d,!A,d*A,d,!d*A")
+	(plus:HI (match_operand:HI 1 "general_operand" "%0,0,0,0,0,0,0")
+		 (match_operand:HI 2 "general_operand" "N,I,i,I,mi*A*d,*u,!u*d*w")))]
   "TARGET_M6811"
   "*
 {
@@ -2374,7 +2392,7 @@
   [(set (match_operand:HI 0 "hard_reg_operand" "=A,d")
 	(plus:HI (zero_extend:HI 
 		     (match_operand:QI 1 "nonimmediate_operand" "d,um*A"))
-		 (match_operand:HI 2 "hard_reg_operand" "0,0")))]
+		 (match_operand:HI 2 "general_operand" "0,0")))]
   ""
   "*
 {
@@ -2401,8 +2419,8 @@
   "")
 
 (define_insn "addqi3"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=!d*rm,dq,!*A")
-        (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
+  [(set (match_operand:QI 0 "nonimmediate_noinc_operand" "=!d*rm,dq,!*A")
+        (plus:QI (match_operand:QI 1 "nonimmediate_noinc_operand" "%0,0,0")
                  (match_operand:QI 2 "general_operand" "N,ium*A*d,ium*A*d")))]
   ""
   "*
@@ -2707,9 +2725,9 @@
 
 
 (define_insn "*subhi3"
-  [(set (match_operand:HI 0 "register_operand" "=d,*A,d*A")
-	(minus:HI (match_operand:HI 1 "register_operand" "0,0,0")
-		  (match_operand:HI 2 "general_operand" "im*A*d,im*d*A,!u")))]
+  [(set (match_operand:HI 0 "register_operand" "=d,*A,d,*A")
+	(minus:HI (match_operand:HI 1 "general_operand" "0,0,0,0")
+		  (match_operand:HI 2 "general_operand" "im*A*d,im*d*A,u,!u")))]
   ""
   "*
 {
@@ -2723,7 +2741,7 @@
 
 (define_insn "*subhi3_zext"
   [(set (match_operand:HI 0 "hard_reg_operand" "=d,d")
-	(minus:HI (match_operand:HI 1 "hard_reg_operand" "0,0")
+	(minus:HI (match_operand:HI 1 "general_operand" "0,0")
            (zero_extend:HI (match_operand:QI 2 "general_operand" "mi*A,!u"))))]
   ""
   "*
@@ -2743,7 +2761,7 @@
 
 (define_insn "subqi3"
   [(set (match_operand:QI 0 "hard_reg_operand" "=dq,!*x*y")
-        (minus:QI (match_operand:QI 1 "hard_reg_operand" "0,0")
+        (minus:QI (match_operand:QI 1 "general_operand" "0,0")
                   (match_operand:QI 2 "general_operand" "uim*A*d,uim*A*d")))]
   ""
   "*
@@ -2837,6 +2855,32 @@
   return \"emul\\n\\texg\\tx,y\";
 }")
 
+(define_insn "umulhisi3_hc11"
+  [(set (match_operand:SI 0 "register_operand" "=D,D")
+        (mult:SI (zero_extend:SI
+		     (match_operand:HI 1 "register_operand" "%d,Amu"))
+		 (zero_extend:SI
+	             (match_operand:HI 2 "register_operand" "Amu,d"))))
+   (clobber (match_scratch:HI 3 "=y,y"))]
+  "TARGET_M6811"
+  "*
+{
+  CC_STATUS_INIT;
+  if (!H_REG_P (operands[1]))
+    output_asm_insn (\"ldx\\t%1\", operands);
+  if (!H_REG_P (operands[2]))
+    output_asm_insn (\"ldx\\t%2\", operands);
+
+  if (Y_REG_P (operands[1]) || Y_REG_P (operands[2]))
+    output_asm_insn (\"pshy\", operands);
+  else if (X_REG_P (operands[1]) || X_REG_P (operands[2])
+           || !H_REG_P (operands[1]) || !H_REG_P (operands[2]))
+    output_asm_insn (\"pshx\", operands);
+
+  output_asm_insn (\"bsr\\t__mulhi32\", operands);
+  return \"ins\\n\\tins\";
+}")
+
 (define_insn "mulhisi3"
   [(set (match_operand:SI 0 "register_operand" "=D,D")
         (mult:SI (sign_extend:SI
@@ -2896,8 +2940,8 @@
 
 (define_insn "mulqi3"
   [(set (match_operand:QI 0 "register_operand" "=d,*x,*y")
-        (mult:QI (match_operand:QI 1 "nonimmediate_operand" "%dum,0,0")
-		 (match_operand:QI 2 "general_operand" "dium,*xium,*yium")))]
+        (mult:QI (match_operand:QI 1 "general_operand" "%di*um,0,0")
+		 (match_operand:QI 2 "general_operand" "di*um,*xium,*yium")))]
   ""
   "*
 {
@@ -2952,11 +2996,11 @@
   ")
 
 (define_insn "mulqihi3"
-  [(set (match_operand:HI 0 "register_operand" "=d,d")
+  [(set (match_operand:HI 0 "register_operand" "=d,d,d")
         (mult:HI (sign_extend:HI
-			(match_operand:QI 1 "register_operand" "%0,0"))
+			(match_operand:QI 1 "register_operand" "%0,0,0"))
 		 (sign_extend:HI
-                        (match_operand:QI 2 "nonimmediate_operand" "dm,*A"))))]
+                        (match_operand:QI 2 "general_operand" "mi*u,*A,0"))))]
   ""
   "*
 {
@@ -3054,21 +3098,29 @@
 ;;- and instructions.
 ;;--------------------------------------------------------------------
 
-(define_insn "anddi3"
+(define_insn_and_split "anddi3"
   [(set (match_operand:DI 0 "reg_or_some_mem_operand" "=m,u")
 	(and:DI (match_operand:DI 1 "reg_or_some_mem_operand" "%imu,imu")
 		(match_operand:DI 2 "general_operand" "imu,imu")))
    (clobber (match_scratch:HI 3 "=d,d"))]
   ""
-  "#")
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_logical (SImode, AND, operands);
+   DONE;")
 
-(define_insn "andsi3"
+(define_insn_and_split "andsi3"
   [(set (match_operand:SI 0 "register_operand" "=D,!u")
 	(and:SI (match_operand:SI 1 "register_operand" "%0,0")
 		(match_operand:SI 2 "general_operand" "Dimu,imu")))
    (clobber (match_scratch:HI 3 "=X,d"))]
   ""
-  "#")
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_logical (HImode, AND, operands);
+   DONE;")
 
 (define_expand "andhi3"
   [(set (match_operand:HI 0 "register_operand" "")
@@ -3078,10 +3130,10 @@
   "")
 
 (define_insn "*andhi3_mem"
-  [(set (match_operand:HI 0 "memory_operand" "=Q,R")
+  [(set (match_operand:HI 0 "memory_operand" "=R,Q")
 	(and:HI (match_dup 0)
 	        (match_operand:HI 1 "immediate_operand" "i,i")))
-   (clobber (match_scratch:HI 2 "=xy,X"))]
+   (clobber (match_scratch:HI 2 "=X,xy"))]
   "TARGET_RELAX && !TARGET_M6812"
   "*
 {
@@ -3101,7 +3153,7 @@
   /* When destination is a global variable, generate a .relax instruction
      and load the address in the clobber register.  That load can be
      eliminated by the linker if the address is in page0.  */
-  if (which_alternative == 0)
+  if (which_alternative == 1)
     {
       rtx ops[3];
 
@@ -3216,8 +3268,8 @@
 
 (define_insn "*andhi3_gen"
   [(set (match_operand:HI 0 "register_operand" "=d,d,!*A")
-	(and:HI (match_operand:HI 1 "register_operand" "%0,0,0")
-		(match_operand:HI 2 "general_operand" "mi,!u*A,!um*A")))]
+	(and:HI (match_operand:HI 1 "splitable_operand" "%0,0,0")
+		(match_operand:HI 2 "splitable_operand" "mi,!u*A,!um*Ai")))]
   ""
   "*
 {
@@ -3236,10 +3288,10 @@
   "")
 
 (define_insn "*andqi3_mem"
-  [(set (match_operand:QI 0 "memory_operand" "=Q,R")
+  [(set (match_operand:QI 0 "memory_operand" "=R,Q")
 	(and:QI (match_dup 0)
 	        (match_operand:QI 1 "const_int_operand" "i,i")))
-   (clobber (match_scratch:HI 2 "=xy,X"))]
+   (clobber (match_scratch:HI 2 "=X,xy"))]
   "TARGET_RELAX && !TARGET_M6812"
   "*
 {
@@ -3257,7 +3309,7 @@
   /* When destination is a global variable, generate a .relax instruction
      and load the address in the clobber register.  That load can be
      eliminated by the linker if the address is in page0.  */
-  if (which_alternative == 0)
+  if (which_alternative == 1)
     {
       rtx ops[3];
 
@@ -3310,8 +3362,8 @@
 
 (define_insn "*andqi3_gen"
   [(set (match_operand:QI 0 "register_operand" "=d,d,d,?*A,?*A,!*q")
-        (and:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0,0")
-             (match_operand:QI 2 "general_operand" "mi,!u,?*A,!um,?*A*d,!um*A")))]
+        (and:QI (match_operand:QI 1 "general_operand" "%0,0,0,0,0,0")
+             (match_operand:QI 2 "general_operand" "mi,!*u,?*A,!*um,?*A*d,!*um*A")))]
   ""
   "*
 {
@@ -3330,34 +3382,42 @@
 ;;- Bit set or instructions.
 ;;--------------------------------------------------------------------
 
-(define_insn "iordi3"
+(define_insn_and_split "iordi3"
   [(set (match_operand:DI 0 "reg_or_some_mem_operand" "=m,u")
 	(ior:DI (match_operand:DI 1 "reg_or_some_mem_operand" "%imu,imu")
 		(match_operand:DI 2 "general_operand" "imu,imu")))
    (clobber (match_scratch:HI 3 "=d,d"))]
   ""
-  "#")
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_logical (SImode, IOR, operands);
+   DONE;")
 
-(define_insn "iorsi3"
+(define_insn_and_split "iorsi3"
   [(set (match_operand:SI 0 "register_operand" "=D,!u")
 	(ior:SI (match_operand:SI 1 "register_operand" "%0,0")
 		(match_operand:SI 2 "general_operand" "Dimu,imu")))
    (clobber (match_scratch:HI 3 "=X,d"))]
   ""
-  "#")
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_logical (HImode, IOR, operands);
+   DONE;")
 
 (define_expand "iorhi3"
   [(set (match_operand:HI 0 "register_operand" "")
 	(ior:HI (match_operand:HI 1 "register_operand" "")
-		(match_operand:HI 2 "general_operand" "")))]
+		(match_operand:HI 2 "splitable_operand" "")))]
   ""
   "")
 
 (define_insn "*iorhi3_mem"
-  [(set (match_operand:HI 0 "memory_operand" "=Q,R")
+  [(set (match_operand:HI 0 "memory_operand" "=R,Q")
 	(ior:HI (match_dup 0)
 	        (match_operand:HI 1 "const_int_operand" "")))
-   (clobber (match_scratch:HI 2 "=xy,X"))]
+   (clobber (match_scratch:HI 2 "=X,xy"))]
   "TARGET_RELAX && !TARGET_M6812"
   "*
 {
@@ -3369,7 +3429,7 @@
       return \"\";
     }
   CC_STATUS_INIT;
-  if (which_alternative == 0)
+  if (which_alternative == 1)
     {
       rtx ops[3];
 
@@ -3437,8 +3497,8 @@
 
 (define_insn "*iorhi3_gen"
   [(set (match_operand:HI 0 "register_operand" "=d,d,!*A")
-	(ior:HI (match_operand:HI 1 "register_operand" "%0,0,0")
-		(match_operand:HI 2 "general_operand" "mi,!u*A,!um*A")))]
+	(ior:HI (match_operand:HI 1 "splitable_operand" "%0,0,0")
+		(match_operand:HI 2 "splitable_operand" "mi,!u*A,!um*Ai")))]
   ""
   "*
 {
@@ -3457,10 +3517,10 @@
   "")
 
 (define_insn "*iorqi3_mem"
-  [(set (match_operand:QI 0 "memory_operand" "=Q,R")
+  [(set (match_operand:QI 0 "memory_operand" "=R,Q")
 	(ior:QI (match_dup 0)
 	        (match_operand:QI 1 "const_int_operand" "")))
-   (clobber (match_scratch:HI 2 "=xy,X"))]
+   (clobber (match_scratch:HI 2 "=X,xy"))]
   "TARGET_RELAX && !TARGET_M6812"
   "*
 {
@@ -3471,7 +3531,7 @@
       cc_status = cc_prev_status;
       return \"\";
     }
-  if (which_alternative == 0)
+  if (which_alternative == 1)
     {
       rtx ops[3];
 
@@ -3520,8 +3580,8 @@
 
 (define_insn "*iorqi3_gen"
   [(set (match_operand:QI 0 "register_operand" "=d,d,d,?*A,?*A,!*q")
-	(ior:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0,0")
-	     (match_operand:QI 2 "general_operand" "mi,!u,!*A,!um,?*A*d,!um*A")))]
+	(ior:QI (match_operand:QI 1 "general_operand" "%0,0,0,0,0,0")
+	     (match_operand:QI 2 "general_operand" "mi,!*u,!*A,!*um,?*A*d,!*um*A")))]
   ""
   "*
 {
@@ -3541,26 +3601,34 @@
 ;;- xor instructions.
 ;;--------------------------------------------------------------------
 
-(define_insn "xordi3"
+(define_insn_and_split "xordi3"
   [(set (match_operand:DI 0 "reg_or_some_mem_operand" "=m,u")
 	(xor:DI (match_operand:DI 1 "reg_or_some_mem_operand" "%imu,imu")
 		(match_operand:DI 2 "general_operand" "imu,imu")))
    (clobber (match_scratch:HI 3 "=d,d"))]
   ""
-  "#")
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_logical (SImode, XOR, operands);
+   DONE;")
 
-(define_insn "xorsi3"
+(define_insn_and_split "xorsi3"
   [(set (match_operand:SI 0 "register_operand" "=D,!u")
 	(xor:SI (match_operand:SI 1 "register_operand" "%0,0")
 		(match_operand:SI 2 "general_operand" "Dimu,imu")))
    (clobber (match_scratch:HI 3 "=X,d"))]
   ""
-  "#")
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  "m68hc11_split_logical (HImode, XOR, operands);
+   DONE;")
 
 (define_insn "xorhi3"
   [(set (match_operand:HI 0 "register_operand" "=d,d,!*A")
-	(xor:HI (match_operand:HI 1 "register_operand" "%0,0,0")
-		(match_operand:HI 2 "general_operand" "im,!u*A,!ium*A")))]
+	(xor:HI (match_operand:HI 1 "splitable_operand" "%0,0,0")
+		(match_operand:HI 2 "splitable_operand" "im,!u*A,!ium*A")))]
   ""
   "*
 {
@@ -3604,8 +3672,8 @@
 
 (define_insn "xorqi3"
   [(set (match_operand:QI 0 "register_operand" "=d,d,d,?*A,?*A,!*q")
-        (xor:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0,0")
-             (match_operand:QI 2 "general_operand" "im,!u,!*A,!ium,?*A*d,!ium*A")))]
+        (xor:QI (match_operand:QI 1 "general_operand" "%0,0,0,0,0,0")
+             (match_operand:QI 2 "general_operand" "im,!*u,!*A,!i*um,?*A*d,!i*um*A")))]
   ""
   "*
 {
@@ -3641,30 +3709,47 @@
 ;;- Bit set or instructions.
 ;;--------------------------------------------------------------------
 
-(define_insn "*logicalsi3_zexthi"
+(define_insn_and_split "*logicalsi3_zexthi"
   [(set (match_operand:SI 0 "register_operand" "=D")
 	(match_operator:SI 3 "m68hc11_logical_operator"
 		[(zero_extend:SI
 		     (match_operand:HI 1 "general_operand" "imudA"))
 		 (match_operand:SI 2 "general_operand" "Dimu")]))]
   ""
-  "#")
+  "#"
+  "reload_completed"
+  [(set (reg:HI D_REGNUM) (match_dup 4))
+   (set (reg:HI D_REGNUM) (match_op_dup 3 [(reg:HI D_REGNUM) (match_dup 5)]))
+   (set (reg:HI X_REGNUM) (match_dup 6))]
+  "PUT_MODE (operands[3], HImode);
+   if (X_REG_P (operands[2]))
+     {
+       operands[5] = operands[1];
+       /* Make all the (set (REG:x) (REG:y)) a nop set.  */
+       operands[4] = gen_rtx (REG, HImode, HARD_D_REGNUM);
+       operands[6] = gen_rtx (REG, HImode, HARD_X_REGNUM);
+     }
+   else
+     {
+       operands[4] = operands[1];
+       operands[5] = m68hc11_gen_lowpart (HImode, operands[2]);
+       operands[6] = m68hc11_gen_highpart (HImode, operands[2]);
+     }
+   /* For an AND, make sure the high 16-bit part is cleared.  */
+   if (GET_CODE (operands[3]) == AND)
+     {
+       operands[6] = const0_rtx;
+     }
+   ")
 
-(define_insn "*logicalsi3_zextqi"
+(define_insn_and_split "*logicalsi3_zextqi"
   [(set (match_operand:SI 0 "register_operand" "=D,D,D")
 	(match_operator:SI 3 "m68hc11_logical_operator"
 		[(zero_extend:SI
 		     (match_operand:QI 1 "general_operand" "d,*A,imu"))
 		 (match_operand:SI 2 "general_operand" "imu,imu,0")]))]
   ""
-  "#")
-
-(define_split /* logicalsi3_zextqi */
-  [(set (match_operand:SI 0 "register_operand" "")
-	(match_operator:SI 3 "m68hc11_logical_operator"
-	         [(zero_extend:SI
-		     (match_operand:QI 1 "general_operand" ""))
-		  (match_operand:SI 2 "general_operand" "")]))]
+  "#"
   "z_replacement_completed == 2"
   [(set (reg:QI A_REGNUM) (match_dup 4))
    (set (reg:QI D_REGNUM) (match_dup 7))
@@ -3695,63 +3780,47 @@
      }
    ")
 
-(define_split /* logicalsi3_zexthi */
-  [(set (match_operand:SI 0 "register_operand" "")
-	(match_operator:SI 3 "m68hc11_logical_operator"
-	         [(zero_extend:SI
-		     (match_operand:HI 1 "general_operand" ""))
-		  (match_operand:SI 2 "general_operand" "")]))]
-  "reload_completed"
-  [(set (reg:HI D_REGNUM) (match_dup 4))
-   (set (reg:HI D_REGNUM) (match_op_dup 3 [(reg:HI D_REGNUM) (match_dup 5)]))
-   (set (reg:HI X_REGNUM) (match_dup 6))]
-  "PUT_MODE (operands[3], HImode);
-   if (X_REG_P (operands[2]))
-     {
-       operands[5] = operands[1];
-       /* Make all the (set (REG:x) (REG:y)) a nop set.  */
-       operands[4] = gen_rtx (REG, HImode, HARD_D_REGNUM);
-       operands[6] = gen_rtx (REG, HImode, HARD_X_REGNUM);
-     }
-   else
-     {
-       operands[4] = operands[1];
-       operands[5] = m68hc11_gen_lowpart (HImode, operands[2]);
-       operands[6] = m68hc11_gen_highpart (HImode, operands[2]);
-     }
-   /* For an AND, make sure the high 16-bit part is cleared.  */
-   if (GET_CODE (operands[3]) == AND)
-     {
-       operands[6] = const0_rtx;
-     }
-   ")
-
-(define_insn "*logicalhi3_zexthi_ashift8"
+(define_insn_and_split "*logicalhi3_zexthi_ashift8"
   [(set (match_operand:HI 0 "register_operand" "=d")
 	(match_operator:HI 3 "m68hc11_logical_operator"
 		[(zero_extend:HI
-		     (match_operand:QI 1 "general_operand" "imud"))
+		     (match_operand:QI 1 "general_operand" "imud*A"))
 		 (ashift:HI
-		     (match_operand:HI 2 "general_operand" "dimu")
+		     (match_operand:HI 2 "general_operand" "imud*A")
 		     (const_int 8))]))]
   ""
-  "#")
+  "#"
+  "z_replacement_completed == 2"
+  [(set (reg:QI A_REGNUM) (match_dup 4))
+   (set (reg:QI B_REGNUM) (match_dup 5))]
+  "
+   if (GET_CODE (operands[3]) == AND)
+     {
+       emit_insn (gen_movhi (operands[0], const0_rtx));
+       DONE;
+     }
+   else
+     {
+       operands[5] = operands[1];
+       if (D_REG_P (operands[2]))
+         {
+           operands[4] = gen_rtx (REG, QImode, HARD_B_REGNUM);
+         }
+       else
+         {
+           operands[4] = m68hc11_gen_lowpart (QImode, operands[2]);
+         }
+     }
+  ")
 
-(define_insn "*logicalhi3_zexthi"
+(define_insn_and_split "*logicalhi3_zexthi"
   [(set (match_operand:HI 0 "register_operand" "=d,d")
 	(match_operator:HI 3 "m68hc11_logical_operator"
 		[(zero_extend:HI
 		     (match_operand:QI 1 "general_operand" "imd*A,?u"))
 		 (match_operand:HI 2 "general_operand" "dim,?dimu")]))]
   ""
-  "#")
-
-(define_split /* logicalhi3_zexthi */
-  [(set (match_operand:HI 0 "register_operand" "")
-	(match_operator:HI 3 "m68hc11_logical_operator"
-		[(zero_extend:HI
-		     (match_operand:QI 1 "general_operand" ""))
-		 (match_operand:HI 2 "general_operand" "")]))]
+  "#"
   "z_replacement_completed == 2"
   [(set (reg:QI B_REGNUM) (match_dup 6))
    (set (reg:QI A_REGNUM) (match_dup 4))
@@ -3780,63 +3849,25 @@
      }
   ")
 
-(define_split /* logicalhi3_zexthi_ashift8 */
-  [(set (match_operand:HI 0 "register_operand" "")
-	(match_operator:HI 3 "m68hc11_logical_operator"
-		[(zero_extend:HI
-		     (match_operand:QI 1 "general_operand" ""))
-		 (ashift:HI
-		     (match_operand:HI 2 "general_operand" "")
-		     (const_int 8))]))]
-  "z_replacement_completed == 2"
-  [(set (reg:QI A_REGNUM) (match_dup 4))
-   (set (reg:QI B_REGNUM) (match_dup 5))]
-  "
-   if (GET_CODE (operands[3]) == AND)
+
+(define_insn_and_split "*logicalsi3_silshr16"
+  [(set (match_operand:SI 0 "register_operand" "=D,D,D,?D")
+          (match_operator:SI 3 "m68hc11_logical_operator"
+	      [(lshiftrt:SI 
+		   (match_operand:SI 1 "general_operand" "uim,uim,0,0")
+		   (const_int 16))
+		(match_operand:SI 2 "general_operand" "uim,0,uim,0")]))]
+  ""
+  "#"
+  "reload_completed"
+  [(set (reg:HI D_REGNUM) (match_dup 4))
+   (set (reg:HI D_REGNUM) (match_op_dup 3 [(reg:HI D_REGNUM) (match_dup 5)]))
+   (set (reg:HI X_REGNUM) (match_dup 6))]
+  "operands[5] = m68hc11_gen_highpart (HImode, operands[1]);
+   if (X_REG_P (operands[2]))
      {
-       emit_insn (gen_movhi (operands[0], const0_rtx));
-       DONE;
-     }
-   else
-     {
-       operands[5] = operands[1];
-       if (D_REG_P (operands[2]))
-         {
-           operands[4] = gen_rtx (REG, QImode, HARD_B_REGNUM);
-         }
-       else
-         {
-           operands[4] = m68hc11_gen_lowpart (QImode, operands[2]);
-         }
-     }
-  ")
-
-(define_insn "*logicalsi3_silshr16"
-  [(set (match_operand:SI 0 "register_operand" "=D,D,D")
-          (match_operator:SI 3 "m68hc11_logical_operator"
-	      [(lshiftrt:SI 
-		   (match_operand:SI 1 "general_operand" "uim,uim,?D")
-		   (const_int 16))
-		(match_operand:SI 2 "general_operand" "uim,0,0")]))]
-  ""
-  "#")
-
-(define_split /* logicalsi3_silshr16 */
-  [(set (match_operand:SI 0 "register_operand" "")
-          (match_operator:SI 3 "m68hc11_logical_operator"
-		[(lshiftrt:SI 
-			(match_operand:SI 1 "general_operand" "")
-			(const_int 16))
-		 (match_operand:SI 2 "general_operand" "")]))]
-  "reload_completed"
-  [(set (reg:HI D_REGNUM) (match_dup 4))
-   (set (reg:HI D_REGNUM) (match_op_dup 3 [(reg:HI D_REGNUM) (match_dup 5)]))
-   (set (reg:HI X_REGNUM) (match_dup 6))]
-  "operands[5] = m68hc11_gen_highpart (HImode, operands[1]);
-   if (X_REG_P (operands[2]))
-     {
-       operands[4] = gen_rtx (REG, HImode, HARD_D_REGNUM);
-       operands[6] = gen_rtx (REG, HImode, HARD_X_REGNUM);
+       operands[4] = gen_rtx (REG, HImode, HARD_D_REGNUM);
+       operands[6] = gen_rtx (REG, HImode, HARD_X_REGNUM);
      }
    else
      {
@@ -3852,7 +3883,7 @@
      }
 ")
 
-(define_insn "*logicalsi3_silshl16"
+(define_insn_and_split "*logicalsi3_silshl16"
   [(set (match_operand:SI 0 "register_operand" "=D,D")
           (match_operator:SI 3 "m68hc11_logical_operator"
 	      [(ashift:SI 
@@ -3860,15 +3891,7 @@
 		   (const_int 16))
 		(match_operand:SI 2 "general_operand" "0,0")]))]
   ""
-  "#")
-
-(define_split /* logicalsi3_silshl16 */
-  [(set (match_operand:SI 0 "register_operand" "")
-          (match_operator:SI 3 "m68hc11_logical_operator"
-		[(ashift:SI 
-			(match_operand:SI 1 "general_operand" "")
-			(const_int 16))
-		 (match_operand:SI 2 "general_operand" "")]))]
+  "#"
   "z_replacement_completed == 2"
   [(set (reg:HI X_REGNUM) (match_op_dup 3 [(reg:HI X_REGNUM) (match_dup 4)]))
    (set (reg:HI D_REGNUM) (match_dup 5))]
@@ -3881,48 +3904,45 @@
      operands[5] = gen_rtx (REG, HImode, HARD_D_REGNUM);
    ")
 
-
-;;--------------------------------------------------------------------
-;;- 64/32-bit Logical Operations.  Patterns are defined so that GCC
-;; can optimize correctly.  These insns are split by the `final'
-;; pass (# pattern).  They are split to fall in the corresponding
-;; 16-bit logical patterns.
-;;--------------------------------------------------------------------
-
-;; Split 64-bit logical operations: anddi3, iordi3, xordi3
-(define_split
-  [(set (match_operand:DI 0 "reg_or_some_mem_operand" "")
-	(match_operator:DI 4 "m68hc11_logical_operator"
-	     [(match_operand:DI 1 "reg_or_some_mem_operand" "")
-	      (match_operand:DI 2 "general_operand" "")]))
-   (clobber (match_scratch:HI 3 ""))]
+(define_insn_and_split "*logicalsi3_silshl16_zext"
+  [(set (match_operand:SI 0 "register_operand" "=D,D,D")
+          (match_operator:SI 3 "m68hc11_logical_operator"
+	      [(ashift:SI
+	          (zero_extend:SI
+		     (match_operand:HI 1 "general_operand" "uim,udA,!dA"))
+		  (const_int 16))
+	    (zero_extend:SI (match_operand:HI 2 "general_operand" "uidA,um,!dA"))]))]
+  ""
+  "#"
+  ;; Must split before z register replacement
   "reload_completed"
-  [(const_int 0)]
-  "m68hc11_split_logical (SImode, GET_CODE (operands[4]), operands);
-   DONE;")
-
-;; Split 32-bit logical operations: andsi3, iorsi3, xorsi3
-(define_split
-  [(set (match_operand:SI 0 "register_operand" "")
-	(match_operator:SI 3 "m68hc11_logical_operator"
-	     [(match_operand:SI 1 "register_operand" "")
-	      (match_operand:SI 2 "general_operand" "")]))]
-  "0 && reload_completed"
-  [(const_int 0)]
-  "m68hc11_split_logical (HImode, GET_CODE (operands[3]), operands);
-   DONE;")
+  [(set (match_dup 4) (match_dup 5))
+   (set (match_dup 6) (match_dup 7))]
+  "
+    /* set (X_REGNUM) (d), set (D_REGNUM) (1) */
+   if (GET_CODE (operands[1]) == HARD_D_REGNUM
+       && GET_CODE (operands[3]) != AND)
+     {
+       /* This particular case is too early to be split before
+          Z register replacement because the cse-reg pass we do
+	  does not recognize the 'swap_areg'.  It is ok to handle
+	  this case after.  */
+       if (z_replacement_completed != 2)
+         {
+	   FAIL;
+	 }
+       emit_move_insn (gen_rtx (REG, HImode, HARD_X_REGNUM), operands[2]);
+       emit_insn (gen_swap_areg (gen_rtx (REG, HImode, HARD_D_REGNUM),
+			         gen_rtx (REG, HImode, HARD_X_REGNUM)));
+     }
+   operands[4] = gen_rtx (REG, HImode, HARD_D_REGNUM);
+   operands[6] = gen_rtx (REG, HImode, HARD_X_REGNUM);
+   operands[5] = operands[2];
+   operands[7] = operands[1];
 
-;; Split 32-bit logical operations: andsi3, iorsi3, xorsi3
-(define_split
-  [(set (match_operand:SI 0 "reg_or_some_mem_operand" "")
-	(match_operator:SI 4 "m68hc11_logical_operator"
-	     [(match_operand:SI 1 "reg_or_some_mem_operand" "")
-	      (match_operand:SI 2 "general_operand" "")]))
-   (clobber (match_scratch:HI 3 ""))]
-  "reload_completed"
-  [(const_int 0)]
-  "m68hc11_split_logical (HImode, GET_CODE (operands[4]), operands);
-   DONE;")
+   if (GET_CODE (operands[3]) == AND)
+     operands[5] = operands[7] = const0_rtx;
+   ")
 
 ;;--------------------------------------------------------------------
 ;; 16-bit Arithmetic and logical operations on X and Y:
@@ -4323,8 +4343,8 @@
    xgd%0\\n\\tcoma\\n\\tcomb\\n\\txgd%0\\n\\tin%0")
 
 (define_insn "negqi2"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=d,m,!u,!*A")
-	(neg:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,0,0")))]
+  [(set (match_operand:QI 0 "nonimmediate_noinc_operand" "=d,m,!u,!*A")
+	(neg:QI (match_operand:QI 1 "nonimmediate_noinc_operand" "0,0,0,0")))]
   ""
   "@
    negb
@@ -4421,19 +4441,13 @@
     }
 }")
 
-(define_insn "*ashldi3_const32"
+(define_insn_and_split "*ashldi3_const32"
   [(set (match_operand:DI 0 "nonimmediate_operand" "=<,m,u")
 	(ashift:DI (match_operand:DI 1 "general_operand" "umi,umi,umi")
 		   (const_int 32)))
    (clobber (match_scratch:HI 2 "=&A,d,d"))]
    ""
-   "#")
-
-(define_split
-  [(set (match_operand:DI 0 "nonimmediate_operand" "")
-	(ashift:DI (match_operand:DI 1 "general_operand" "")
-		   (const_int 32)))
-   (clobber (match_scratch:HI 2 ""))]
+   "#"
    "reload_completed"
    [(const_int 0)]
    "/* Move the lowpart in the highpart first in case the shift
@@ -4442,6 +4456,13 @@
       {
          m68hc11_split_move (m68hc11_gen_lowpart (SImode, operands[0]),
 			     const0_rtx, operands[2]);
+
+         /* Adjust first operand if it uses SP so that we take into
+            account the above push.  Can occur only for 68HC12.  */
+         if (reg_mentioned_p (gen_rtx (REG, HImode, HARD_SP_REGNUM),
+	                      operands[1]))
+           operands[1] = adjust_address (operands[1],
+	                                 GET_MODE (operands[0]), 4);
       }
     m68hc11_split_move (m68hc11_gen_highpart (SImode, operands[0]),
 		        m68hc11_gen_lowpart (SImode, operands[1]),
@@ -4453,19 +4474,13 @@
       }
     DONE;")
 
-(define_insn "*ashldi3_const1"
+(define_insn_and_split "*ashldi3_const1"
   [(set (match_operand:DI 0 "non_push_operand" "=m,m,u")
 	(ashift:DI (match_operand:DI 1 "general_operand" "mi,u,umi")
 		   (const_int 1)))
    (clobber (match_scratch:HI 2 "=d,d,d"))]
    ""
-   "#")
-
-(define_split
-  [(set (match_operand:DI 0 "non_push_operand" "")
-	(ashift:DI (match_operand:DI 1 "general_operand" "")
-		   (const_int 1)))
-   (clobber (match_scratch:HI 2 ""))]
+   "#"
    "z_replacement_completed == 2"
    [(set (match_dup 2) (match_dup 3))
     (set (match_dup 2) (ashift:HI (match_dup 2) (const_int 1)))
@@ -4505,10 +4520,10 @@
     operands[8] = m68hc11_gen_lowpart (HImode, operands[8]);")
 
 (define_insn "addsi_silshr16"
-  [(set (match_operand:SI 0 "register_operand" "=D,D")
-          (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "!*uim,0")
+  [(set (match_operand:SI 0 "register_operand" "=D,D,!D")
+          (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "!*uim,0,0")
 				(const_int 16))
-		   (match_operand:SI 2 "general_operand" "0,m!*u")))]
+		   (match_operand:SI 2 "general_operand" "0,m!*u,0")))]
   ""
   "#")
 
@@ -4530,14 +4545,24 @@
 				(const_int 16))
 		   (match_operand:SI 2 "general_operand" "")))]
   "z_replacement_completed == 2 && X_REG_P (operands[1])"
-  [(set (reg:HI D_REGNUM) (reg:HI X_REGNUM))
+  [(set (reg:HI D_REGNUM) (match_dup 5))
    (set (reg:HI X_REGNUM) (match_dup 3))
    (set (reg:HI D_REGNUM) (plus:HI (reg:HI D_REGNUM) (match_dup 4)))
    (set (reg:HI X_REGNUM) (plus:HI (plus:HI (reg:HI X_REGNUM)
 					    (const_int 0))
 				   (reg:HI CC_REGNUM)))]
   "operands[3] = m68hc11_gen_highpart (HImode, operands[2]);
-   operands[4] = m68hc11_gen_lowpart (HImode, operands[2]);")
+   if (X_REG_P (operands[2]))
+     {
+       operands[4] = gen_rtx (REG, HImode, HARD_X_REGNUM);
+       operands[5] = gen_rtx (REG, HImode, HARD_D_REGNUM);
+     }
+   else
+     {
+       operands[4] = m68hc11_gen_lowpart (HImode, operands[2]);
+       operands[5] = gen_rtx (REG, HImode, HARD_X_REGNUM);
+     }
+")
 
 (define_insn "addsi_ashift16"
   [(set (match_operand:SI 0 "register_operand" "=D")
@@ -4563,24 +4588,27 @@
   operands[4] = m68hc11_gen_lowpart (HImode, operands[2]);
 }")
 
-(define_insn "addsi_andshr16"
+(define_insn_and_split "addsi_andshr16"
   [(set (match_operand:SI 0 "register_operand" "=D")
           (plus:SI (and:SI (match_operand:SI 1 "general_operand" "%uim")
 			   (const_int 65535))
 		   (match_operand:SI 2 "general_operand" "0")))]
   ""
-  "#")
-
-(define_split
-  [(set (match_operand:SI 0 "register_operand" "")
-          (plus:SI (and:SI (match_operand:SI 1 "general_operand" "")
-			   (const_int 65535))
-		   (match_operand:SI 2 "general_operand" "")))]
+  "#"
   "z_replacement_completed == 2"
   [(set (reg:HI D_REGNUM) (plus:HI (reg:HI D_REGNUM) (match_dup 3)))
    (set (reg:HI X_REGNUM) (plus:HI (plus:HI (reg:HI X_REGNUM) (const_int 0)) (reg:HI CC_REGNUM)))]
   "operands[3] = m68hc11_gen_lowpart (HImode, operands[1]);")
 
+(define_insn "subhi_ashlhi8"
+  [(set (match_operand:HI 0 "register_operand" "=d")
+          (minus:HI (match_operand:HI 1 "register_operand" "0")
+                    (mult:HI (match_operand:HI 2 "register_operand" "0")
+			     (const_int 256))))]
+  "0"
+  "@
+   sba")
+
 ;;
 ;; 32-bit shifts are made by a small library routine that uses
 ;; a specific passing convention for parameters (for efficiency reasons).
@@ -4622,31 +4650,24 @@
    ""
    "#")
 
-(define_insn "*ashlsi3_const16_zexthi"
+(define_insn_and_split "*ashlsi3_const16_zexthi"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=D")
 	(ashift:SI (zero_extend:HI 
 			(match_operand:HI 1 "general_operand" "duim*A"))
 	           (const_int 16)))
    (clobber (match_scratch:HI 2 "=X"))]
    ""
-   "#")
-
-(define_split /* "*ashlsi3_const16_zexthi"*/
-  [(set (match_operand:SI 0 "nonimmediate_operand" "")
-	(ashift:SI (zero_extend:HI 
-			(match_operand:HI 1 "general_operand" ""))
-	           (const_int 16)))
-   (clobber (match_scratch:HI 2 "=X"))]
+   "#"
    "reload_completed"
    [(set (reg:HI X_REGNUM) (match_dup 1))
     (set (reg:HI D_REGNUM) (const_int 0))]
    "")
 
 (define_insn "*ashlsi3_const1"
-  [(set (match_operand:SI 0 "non_push_operand" "=D,D,m,!*u,?*um")
-	(ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,*um,0,0,*um")
+  [(set (match_operand:SI 0 "non_push_operand" "=D,D,D,m,*u,*u")
+	(ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,m,*u,m,*u,m")
 	           (const_int 1)))
-   (clobber (match_scratch:HI 2 "=X,X,&d,&d,&d"))]
+   (clobber (match_scratch:HI 2 "=X,X,X,&d,&d,&d"))]
    ""
    "*
 {
@@ -4702,7 +4723,7 @@
 	(ashift:SI (match_dup 0)
 	           (match_operand:HI 1 "const_int_operand" "")))
    (clobber (match_scratch:HI 2 "=y"))]
-   ""
+   "TARGET_M6811 /* See *ashlsi3 note.  */"
    "*
 {
   CC_STATUS_INIT;
@@ -4712,7 +4733,7 @@
 (define_insn "*ashlsi3"
   [(set (match_operand:SI 0 "register_operand" "+D,D")
 	(ashift:SI (match_dup 0)
-	           (match_operand:HI 1 "general_operand" "y,m")))
+	           (match_operand:HI 1 "general_operand" "y,mi")))
    (clobber (match_scratch:HI 2 "=1,X"))]
    ""
    "*
@@ -4725,7 +4746,12 @@
      is not enough register in class A_REGS.
 
      Assuming that 'operands[1]' does not refer to the stack (which 
-     is true for 68hc11 only, we save temporary the value of Y.  */
+     is true for 68hc11 only, we save temporary the value of Y.
+
+     For 68HC12 we must also accept a constant because Z register is
+     disabled when compiling with -fomit-frame-pointer.  We can come up
+     with a reload problem and the *lshrsi3_const pattern was disabled
+     for that reason.  */
   if (!Y_REG_P (operands[2]))
     {
       rtx ops[1];
@@ -4861,8 +4887,8 @@
    "")
 
 (define_insn "*ashlqi3_const1"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=d,m,!u,!*q,!*A")
-	(ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,0,0,0")
+  [(set (match_operand:QI 0 "nonimmediate_noinc_operand" "=d,m,!u,!*q,!*A")
+	(ashift:QI (match_operand:QI 1 "nonimmediate_noinc_operand" "0,0,0,0,0")
 	           (const_int 1)))]
   ""
   "@
@@ -5112,7 +5138,7 @@
 	(ashiftrt:SI (match_dup 0)
 	             (match_operand:HI 1 "const_int_operand" "")))
    (clobber (match_scratch:HI 2 "=y"))]
-   ""
+   "TARGET_M6811 /* See *ashrsi3 note.  */"
    "*
 {
   CC_STATUS_INIT;
@@ -5122,7 +5148,7 @@
 (define_insn "*ashrsi3"
   [(set (match_operand:SI 0 "register_operand" "+D,D")
 	(ashiftrt:SI (match_dup 0)
-	             (match_operand:HI 1 "general_operand" "y,m")))
+	             (match_operand:HI 1 "general_operand" "y,mi")))
    (clobber (match_scratch:HI 2 "=1,X"))]
    ""
    "*
@@ -5134,7 +5160,12 @@
      is not enough register in class A_REGS.
 
      Assuming that 'operands[1]' does not refer to the stack (which 
-     is true for 68hc11 only, we save temporary the value of Y.  */
+     is true for 68hc11 only, we save temporary the value of Y.
+
+     For 68HC12 we must also accept a constant because Z register is
+     disabled when compiling with -fomit-frame-pointer.  We can come up
+     with a reload problem and the *lshrsi3_const pattern was disabled
+     for that reason.  */
   if (!Y_REG_P (operands[2]))
     {
       rtx ops[1];
@@ -5162,8 +5193,8 @@
    "")
 
 (define_insn "*ashrqi3_const1"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=d,m,!u,!*q,!*A")
-	(ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,0,0,0")
+  [(set (match_operand:QI 0 "nonimmediate_noinc_operand" "=d,m,!u,!*q,!*A")
+	(ashiftrt:QI (match_operand:QI 1 "nonimmediate_noinc_operand" "0,0,0,0,0")
 		     (const_int 1)))]
   ""
   "@
@@ -5240,19 +5271,13 @@
     }
 }")
 
-(define_insn "*lshrdi3_const32"
+(define_insn_and_split "*lshrdi3_const32"
   [(set (match_operand:DI 0 "nonimmediate_operand" "=<,m,u")
 	(lshiftrt:DI (match_operand:DI 1 "general_operand" "umi,umi,umi")
 		     (const_int 32)))
    (clobber (match_scratch:HI 2 "=&A,d,d"))]
    ""
-   "#")
-
-(define_split
-  [(set (match_operand:DI 0 "nonimmediate_operand" "")
-	(lshiftrt:DI (match_operand:DI 1 "general_operand" "")
-		     (const_int 32)))
-   (clobber (match_scratch:HI 2 "=&A,d"))]
+   "#"
    "reload_completed"
    [(const_int 0)]
    "m68hc11_split_move (m68hc11_gen_lowpart (SImode, operands[0]),
@@ -5322,19 +5347,13 @@
     operands[7] = m68hc11_gen_highpart (HImode, operands[6]);
     operands[6] = m68hc11_gen_lowpart (HImode, operands[6]);")
 
-(define_insn "*lshrdi_const1"
+(define_insn_and_split "*lshrdi_const1"
   [(set (match_operand:DI 0 "non_push_operand" "=m,u")
 	(lshiftrt:DI (match_operand:DI 1 "general_operand" "umi,umi")
 		     (const_int 1)))
    (clobber (match_scratch:HI 2 "=d,d"))]
    ""
-   "#")
-
-(define_split
-  [(set (match_operand:DI 0 "non_push_operand" "")
-	(lshiftrt:DI (match_operand:DI 1 "general_operand" "")
-		     (const_int 1)))
-   (clobber (match_scratch:HI 2 ""))]
+   "#"
    "z_replacement_completed == 2"
    [(set (match_dup 2) (match_dup 3))
     (set (match_dup 2) (lshiftrt:HI (match_dup 2) (const_int 1)))
@@ -5407,10 +5426,10 @@
     #")
 
 (define_insn "*lshrsi3_const1"
-  [(set (match_operand:SI 0 "non_push_operand" "=D,m,*u")
-	(lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "D*um,*um,*um")
+  [(set (match_operand:SI 0 "non_push_operand" "=D,D,D,m,*u,*u")
+	(lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0,m,*u,m,*u,m")
 	             (const_int 1)))
-   (clobber (match_scratch:HI 2 "=X,&d,&d"))]
+   (clobber (match_scratch:HI 2 "=X,X,X,&d,&d,&d"))]
    ""
    "*
 {
@@ -5461,7 +5480,7 @@
 	(lshiftrt:SI (match_dup 0)
 	             (match_operand:HI 1 "const_int_operand" "")))
    (clobber (match_scratch:HI 2 "=y"))]
-   ""
+   "TARGET_M6811 /* See *lshrsi3 note.  */"
    "*
 {
   CC_STATUS_INIT;
@@ -5471,7 +5490,7 @@
 (define_insn "*lshrsi3"
   [(set (match_operand:SI 0 "register_operand" "+D,D")
 	(lshiftrt:SI (match_dup 0)
-	             (match_operand:HI 1 "general_operand" "y,m")))
+	             (match_operand:HI 1 "general_operand" "y,mi")))
    (clobber (match_scratch:HI 2 "=1,X"))]
    ""
    "*
@@ -5483,7 +5502,12 @@
      is not enough register in class A_REGS.
 
      Assuming that 'operands[1]' does not refer to the stack (which 
-     is true for 68hc11 only, we save temporary the value of Y.  */
+     is true for 68hc11 only, we save temporary the value of Y.
+
+     For 68HC12 we must also accept a constant because Z register is
+     disabled when compiling with -fomit-frame-pointer.  We can come up
+     with a reload problem and the *lshrsi3_const pattern was disabled
+     for that reason.  */
   if (!Y_REG_P (operands[2]))
     {
       rtx ops[1];
@@ -5544,8 +5568,8 @@
 }")
 
 (define_insn "lshrhi3_const"
-  [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,!*A,!*A")
-	(lshiftrt:HI (match_operand:HI 1 "general_operand" "dm*A,!u,dm,!u")
+  [(set (match_operand:HI 0 "nonimmediate_noinc_operand" "=d,d,!*A,!*A")
+	(lshiftrt:HI (match_operand:HI 1 "nonimmediate_noinc_operand" "dm*A,!u,dm,!u")
 		     (match_operand:HI 2 "const_int_operand" "i,i,i,i")))]
   ""
   "*
@@ -5649,8 +5673,8 @@
    "")
 
 (define_insn "*lshrqi3_const1"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d,!u,!*q,!*A")
-	(lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,0,0,0")
+  [(set (match_operand:QI 0 "nonimmediate_noinc_operand" "=m,d,!u,!*q,!*A")
+	(lshiftrt:QI (match_operand:QI 1 "nonimmediate_noinc_operand" "0,0,0,0,0")
 		     (const_int 1)))]
   ""
   "@
@@ -5937,6 +5961,98 @@
   "")
 
 ;;--------------------------------------------------------------------
+;;-  Bit test and branch
+;;--------------------------------------------------------------------
+;; Logical and, test if zero and branch to use "brset/brclr" instruction
+;;
+(define_insn "brclr"
+  [(set (pc)
+	(if_then_else
+	  (eq (and:QI (match_operand:QI 0 "memory_operand" "R,Q")
+		      (match_operand:QI 1 "const_int_operand" ""))
+              (const_int 0))
+	 (label_ref (match_operand 2 "" ""))
+	 (pc)))
+   (clobber (match_scratch:HI 3 "=X,xy"))]
+  "0"
+  "*
+{
+  cc_status = cc_prev_status;
+  if (which_alternative == 0 || TARGET_M6812)
+    {
+      return \"brclr\\t%0,%1,%l2\";
+    }
+  else
+    {
+      rtx ops[3];
+
+      ops[0] = operands[3];
+      ops[1] = XEXP (operands[0], 0);
+      ops[2] = gen_label_rtx ();
+      output_asm_insn (\".relax\\t%l2\", ops);
+      m68hc11_gen_movhi (insn, ops);
+      output_asm_insn (\"brclr\\t0,%3,%1,%l2\", operands);
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
+				 CODE_LABEL_NUMBER (ops[2]));
+      return \"\";
+    }
+}")
+
+(define_insn "brset"
+  [(set (pc)
+	(if_then_else
+	  (eq (and:QI (not:QI (match_operand:QI 0 "memory_operand" "R,Q"))
+		      (match_operand:QI 1 "const_int_operand" ""))
+              (const_int 0))
+	 (label_ref (match_operand 2 "" ""))
+	 (pc)))
+   (clobber (match_scratch:HI 3 "=X,xy"))]
+  "0"
+  "*
+{
+  cc_status = cc_prev_status;
+  if (which_alternative == 0 || TARGET_M6812)
+    {
+      return \"brset\\t%0,%1,%l2\";
+    }
+  else
+    {
+      rtx ops[3];
+
+      ops[0] = operands[3];
+      ops[1] = XEXP (operands[0], 0);
+      ops[2] = gen_label_rtx ();
+      output_asm_insn (\".relax\\t%l2\", ops);
+      m68hc11_gen_movhi (insn, ops);
+      output_asm_insn (\"brset\\t0,%3,%1,%l2\", operands);
+      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
+				 CODE_LABEL_NUMBER (ops[2]));
+      return \"\";
+    }
+}")
+
+(define_peephole2
+  [(set (match_operand:QI 0 "hard_reg_operand" "")
+        (match_operand:QI 1 "memory_operand" "m"))
+   (set (cc0) (and:HI (match_operand:HI 2 "hard_reg_operand" "")
+	              (match_operand:HI 3 "const_int_operand" "")))
+   (set (pc)
+        (if_then_else (eq (cc0) (const_int 0))
+		      (label_ref (match_operand 4 "" ""))
+		      (pc)))]
+  "0 && REGNO (operands[0]) == REGNO (operands[2])
+   && peep2_reg_dead_p (2, operands[0])"
+  [(parallel [
+      (set (pc)
+        (if_then_else
+           (eq (and:QI (match_dup 1) (match_dup 3))
+               (const_int 0))
+	   (label_ref (match_dup 4))
+           (pc)))
+      (clobber (match_dup 5))])]
+  "operands[5] = gen_rtx_SCRATCH (HImode);")
+
+;;--------------------------------------------------------------------
 ;;-  68HC12 Decrement/Increment and branch
 ;;--------------------------------------------------------------------
 ;; These patterns are used by loop optimization as well as peephole2
@@ -5976,17 +6092,24 @@
     {
       FAIL;
     }
+
+  /* Note that for xxx_dbcc_dec_yy the gen_rtx_NE is only used to pass
+     the operator and its operands are not relevant.  */
   if (GET_MODE (operands[0]) == HImode)
     {
       emit_jump_insn (gen_m68hc12_dbcc_dec_hi (operands[0],
-					       gen_rtx (NE, HImode),
+					       gen_rtx (NE, HImode,
+						        operands[0],
+							operands[1]),
 					       operands[4]));
       DONE;
     }
   if (GET_MODE (operands[0]) == QImode)
     {
       emit_jump_insn (gen_m68hc12_dbcc_dec_qi (operands[0],
-					       gen_rtx (NE, QImode),
+					       gen_rtx (NE, QImode,
+						        operands[0],
+							operands[1]),
 					       operands[4]));
       DONE;
     }
@@ -6928,18 +7051,81 @@
 ;;
 ;; Replace "leas 2,sp" with a "pulx" or a "puly".
 ;; On 68HC12, this is one cycle slower but one byte smaller.
-;; pr target/6899: This peephole is not valid because a register CSE
-;; pass removes the pulx/puly.
+;; pr target/6899: This peephole was not valid because a register CSE
+;; pass removes the pulx/puly.  The 'use' clause ensure that the pulx is
+;; not removed.
 ;;
 (define_peephole2
   [(set (reg:HI SP_REGNUM) (plus:HI (reg:HI SP_REGNUM) (const_int 2)))
    (match_scratch:HI 0 "xy")]
-  "0 && TARGET_M6812 && optimize_size"
-  [(set (match_dup 0) (match_dup 1))]
+  "TARGET_M6812 && optimize_size"
+  [(set (match_dup 0) (match_dup 1))
+   (use (match_dup 0))]
   "operands[1] = gen_rtx (MEM, HImode,
 			  gen_rtx (POST_INC, HImode,
 				   gen_rtx_REG (HImode, HARD_SP_REGNUM)));")
 
+;; Replace: "pshx; tfr d,x; stx 0,sp" into "pshd; tfr d,x"
+;;
+;; PR 14542: emit a use to pretend we need the value of initial register.
+;; Otherwise verify_local_live_at_start will abort due to a live change
+;; of that register.
+;;
+(define_peephole2
+  [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM)))
+        (match_operand:HI 0 "hard_reg_operand" ""))
+   (set (match_dup 0)
+        (match_operand:HI 1 "hard_reg_operand" ""))
+   (set (mem:HI (reg:HI SP_REGNUM))
+        (match_dup 0))]
+  "TARGET_M6812"
+  [(use (match_dup 0))
+   (set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM)))
+        (match_dup 1))
+   (set (match_dup 0) (match_dup 1))]
+  "")
+
+;;
+;; Change: "ldd 0,sp; pulx" into  "puld"
+;; This sequence usually appears at end a functions.
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+        (mem:HI (reg:HI SP_REGNUM)))
+   (use (match_dup 0))
+   (set (match_operand:HI 1 "hard_reg_operand" "")
+        (mem:HI (post_inc:HI (reg:HI SP_REGNUM))))]
+  "peep2_reg_dead_p (2, operands[1])"
+  [(set (match_dup 0) (mem:HI (post_inc:HI (reg:HI SP_REGNUM))))
+   (use (match_dup 0))]
+  "")
+
+;; Replace: "pshx; clr 0,sp; clr 1,sp" by "clr 1,-sp; clr 1,-sp"
+;; Appears to allocate local variables.
+(define_peephole2
+  [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM)))
+        (match_operand:HI 0 "hard_reg_operand" ""))
+   (set (mem:QI (plus:HI (reg:HI SP_REGNUM) (const_int 1)))
+        (const_int 0))
+   (set (mem:QI (reg:HI SP_REGNUM))
+        (const_int 0))]
+  "TARGET_M6812"
+  [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM)))
+        (const_int 0))]
+  "")
+
+;; Likewise for HI mode
+(define_peephole2
+  [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM)))
+        (match_operand:HI 0 "hard_reg_operand" ""))
+   (set (mem:HI (reg:HI SP_REGNUM))
+        (const_int 0))]
+  "TARGET_M6812"
+  [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNUM)))
+        (const_int 0))]
+  "")
+;;--------------------------------------------------------------------
+;;- 
+;;--------------------------------------------------------------------
 ;;
 ;; Optimize memory<->memory moves when the value is also loaded in
 ;; a register.
@@ -6989,6 +7175,32 @@
    (set (match_dup 0) (match_dup 2))]
   "")
 
+;;--------------------------------------------------------------------
+;;- 
+;;--------------------------------------------------------------------
+;; SCz 2005-05-08: this peephole2 is not finished.  I'm not sure it is
+;; valid in all cases.  Disabled but kept for documentation and futur fix.
+;; (optimize 8-bit move to/from the X or Y registers; the issue with
+;; the first (set) is that since operand 0 is either X or Y, we have to
+;; use the scratch _.tmp memory location; the peephole uses a stack location
+;; instead to save D and use D for the load)
+;;
+(define_peephole2
+  [(set (match_operand:QI 0 "hard_reg_operand" "")
+	(match_operand:QI 1 "memory_operand" ""))
+   (set (match_operand:QI 2 "memory_operand" "")
+        (match_dup 0))]
+  "0 && A_REG_P (operands[0]) && peep2_reg_dead_p (2, operands[0])
+   && !reg_mentioned_p (gen_rtx (REG, HImode, HARD_D_REGNUM), operands[1])
+   && !reg_mentioned_p (gen_rtx (REG, HImode, HARD_D_REGNUM), operands[1])
+   && !reg_mentioned_p (gen_rtx (REG, HImode, REGNO (operands[0])), operands[2])"
+  [(set (mem:QI (pre_dec:HI (reg:HI SP_REGNUM))) (reg:QI D_REGNUM))
+   (set (reg:QI D_REGNUM) (match_dup 1))
+   (set (match_dup 2) (reg:QI D_REGNUM))
+   (set (reg:QI D_REGNUM) (mem:QI (post_inc:HI (reg:HI SP_REGNUM))))
+   (use (reg:HI SP_REGNUM))]
+   "")
+
 ;;
 ;; Reorganize to optimize address computations.
 ;;
@@ -7004,6 +7216,36 @@
   "")
 
 ;;
+;; Replace: "ldx #N; xgdx; addd <var>; xgdx" by "ldab #N; ldx <var>; abx"
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+	(match_operand:HI 1 "const_int_operand" ""))
+   (set (match_dup 0)
+	(plus:HI (match_dup 0)
+	         (match_operand:HI 2 "general_operand" "")))
+   (match_scratch:QI 3 "d")]
+  "TARGET_M6811 && (INTVAL (operands[1]) >= 0 && INTVAL (operands[1]) <= 0x0ff)"
+  [(set (match_dup 3) (match_dup 4))
+   (set (match_dup 0) (match_dup 2))
+   (set (match_dup 0) (plus:HI (zero_extend:HI (match_dup 3)) (match_dup 0)))]
+  "operands[4] = m68hc11_gen_lowpart (QImode, operands[1]);")
+
+;;
+;; Replace: "ldx #N; xgdx; addd <var>; xgdx" by "ldab #N; ldx <var>; abx"
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+	(match_operand:HI 1 "const_int_operand" ""))
+   (set (match_dup 0)
+	(plus:HI (match_dup 0)
+	         (match_operand:HI 2 "general_operand" "")))]
+  "TARGET_M6812"
+  [(set (match_dup 0) (match_dup 2))
+   (set (match_dup 0) (plus:HI (match_dup 0) (match_dup 1)))]
+  "")
+
+;;
 ;; Optimize an address register increment and a compare to use
 ;; a PRE_INC or PRE_DEC addressing mode (disabled on the tst insn
 ;; before reload, but can be enabled after).
@@ -7095,6 +7337,31 @@
   "")
 
 ;;
+;;
+;;
+(define_peephole2
+  [(parallel 
+     [(set (match_operand:SI 0 "hard_reg_operand" "")
+	(ashift:SI (match_operand:SI 1 "general_operand" "")
+		   (const_int 1)))
+      (clobber (match_scratch:HI 2 ""))])
+   (set (match_operand:HI 3 "nonimmediate_operand" "") (reg:HI D_REGNUM))
+   (set (match_operand:HI 4 "nonimmediate_operand" "") (reg:HI X_REGNUM))]
+  "!X_REG_P (operands[1])
+   && peep2_reg_dead_p (2, gen_rtx (REG, HImode, D_REGNUM))
+   && peep2_reg_dead_p (3, gen_rtx (REG, HImode, X_REGNUM))"
+  [(set (reg:HI D_REGNUM) (match_dup 5))
+   (set (reg:HI D_REGNUM) (ashift:HI (reg:HI D_REGNUM) (const_int 1)))
+   (set (match_dup 3) (reg:HI D_REGNUM))
+   (set (reg:HI D_REGNUM) (match_dup 6))
+   (parallel [(set (reg:HI D_REGNUM)
+		   (rotate:HI (reg:HI D_REGNUM) (const_int 1)))
+              (clobber (reg:HI CC_REGNUM))])
+   (set (match_dup 4) (reg:HI D_REGNUM))]
+  "operands[5] = m68hc11_gen_lowpart (HImode, operands[1]);
+   operands[6] = m68hc11_gen_highpart (HImode, operands[1]);")
+
+;;
 ;; Replace a "ldd <mem>; psha; pshb" with a "ldx <mem>; pshx".
 ;;
 (define_peephole2
@@ -7109,6 +7376,25 @@
   "")
 
 ;;
+;; Remove one load when copying a value to/from memory and also
+;; to a register.  Take care not cloberring a possible register used
+;; by operand 2.
+;; Replace: "ldd 0,y; std 2,y; ldx 0,y" into "ldx 0,y; stx 2,y"
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+        (match_operand:HI 1 "general_operand" ""))
+   (set (match_operand:HI 2 "nonimmediate_operand" "") (match_dup 0))
+   (set (match_operand:HI 3 "hard_reg_operand" "") (match_dup 1))]
+  "peep2_reg_dead_p (2, operands[0])
+   && !side_effects_p (operands[1])
+   && !side_effects_p (operands[2])
+   && !reg_mentioned_p (operands[3], operands[2])"
+  [(set (match_dup 3) (match_dup 1))
+   (set (match_dup 2) (match_dup 3))]
+  "")
+
+;;
 ;; Replace a "ldd <mem>; addd #N; std <mem>" into a
 ;; "ldx <mem>; leax; stx <mem>" if we have a free X/Y register
 ;; and the constant is small.
@@ -7131,6 +7417,174 @@
   "if (reg_mentioned_p (operands[4], operands[1])) FAIL;
    if (reg_mentioned_p (operands[4], operands[3])) FAIL;")
 
+;;--------------------------------------------------------------------
+;;- Bset peephole2
+;;--------------------------------------------------------------------
+;; These peepholes try to replace some logical sequences by 'bset' and 'bclr'.
+;;
+;; Replace 'ldab <mem>; orab #N; stab <mem>' by 'bset <mem> #N'.
+;; Register D must be dead and there must be no register side effects for mem.
+;; The <mem> *can* be volatile this is why we must not use 'side_effects_p'.
+;; The good side effect is that it makes the sequence atomic.
+;;
+(define_peephole2
+  [(set (match_operand:QI 0 "hard_reg_operand" "")
+	(match_operand:QI 1 "nonimmediate_operand" ""))
+   (set (match_dup 0) (ior:QI (match_dup 0)
+			      (match_operand:QI 2 "const_int_operand" "")))
+   (set (match_dup 1) (match_dup 0))]
+  "(TARGET_M6812 || m68hc11_indirect_p (operands[1], QImode))
+   && (GET_CODE (operands[1]) != MEM || !auto_inc_p (XEXP (operands[1], 0)))
+   && peep2_reg_dead_p (3, operands[0])"
+  [(set (match_dup 1) (ior:QI (match_dup 1) (match_dup 2)))]
+  "")
+
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+	(match_operand:HI 1 "nonimmediate_operand" ""))
+   (set (match_dup 0) (ior:HI (match_dup 0)
+			      (match_operand:HI 2 "const_int_operand" "")))
+   (set (match_dup 1) (match_dup 0))]
+  "(TARGET_M6812 || m68hc11_indirect_p (operands[1], HImode))
+   && (GET_CODE (operands[1]) != MEM || !auto_inc_p (XEXP (operands[1], 0)))
+   && peep2_reg_dead_p (3, operands[0])"
+  [(set (match_dup 1) (ior:HI (match_dup 1) (match_dup 2)))]
+  "")
+
+;;--------------------------------------------------------------------
+;;- Bclr peephole2
+;;--------------------------------------------------------------------
+;; Replace 'ldab <mem>; andab #N; stab <mem>' by 'bclr <mem> #N'.
+;; See Bset peephole2.
+;;
+(define_peephole2
+  [(set (match_operand:QI 0 "hard_reg_operand" "")
+	(match_operand:QI 1 "nonimmediate_operand" ""))
+   (set (match_dup 0) (and:QI (match_dup 0)
+			      (match_operand:QI 2 "const_int_operand" "")))
+   (set (match_dup 1) (match_dup 0))]
+  "(TARGET_M6812 || m68hc11_indirect_p (operands[1], QImode))
+   && (GET_CODE (operands[1]) != MEM || !auto_inc_p (XEXP (operands[1], 0)))
+   && peep2_reg_dead_p (3, operands[0])"
+  [(set (match_dup 1) (and:QI (match_dup 1) (match_dup 2)))]
+  "")
+
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+	(match_operand:HI 1 "nonimmediate_operand" ""))
+   (set (match_dup 0) (and:HI (match_dup 0)
+			      (match_operand:HI 2 "const_int_operand" "")))
+   (set (match_dup 1) (match_dup 0))]
+  "(TARGET_M6812 || m68hc11_indirect_p (operands[1], HImode))
+   && (GET_CODE (operands[1]) != MEM || !auto_inc_p (XEXP (operands[1], 0)))
+   && peep2_reg_dead_p (3, operands[0])"
+  [(set (match_dup 1) (and:HI (match_dup 1) (match_dup 2)))]
+  "")
+
+
+;;--------------------------------------------------------------------
+;;- Compare peephole2
+;;--------------------------------------------------------------------
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+	(match_operand:HI 1 "hard_reg_operand" ""))
+   (set (match_dup 1) (plus:HI (match_dup 1) 
+                               (match_operand:HI 2 "const_int_operand" "")))
+   (set (cc0) (match_dup 0))]
+  "peep2_reg_dead_p (3, operands[0]) && !Z_REG_P (operands[1])"
+  [(set (match_dup 1) (plus:HI (match_dup 1) (match_dup 2)))
+   (set (cc0) (compare (match_dup 1) (match_dup 2)))]
+  "")
+
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+	(match_operand:HI 1 "hard_reg_operand" ""))
+   (set (match_operand:HI 2 "hard_reg_operand" "")
+        (plus:HI (match_dup 2) 
+                 (match_operand:HI 3 "const_int_operand" "")))
+   (set (match_operand:HI 4 "memory_operand" "") (match_dup 2))
+   (set (cc0) (match_operand:HI 5 "hard_reg_operand" ""))]
+  "peep2_reg_dead_p (4, operands[5]) && !Z_REG_P (operands[2])
+   && !reg_mentioned_p (operands[2], operands[4])
+
+   && ((rtx_equal_p (operands[5], operands[0])
+        && rtx_equal_p (operands[2], operands[1]))
+
+       || (rtx_equal_p (operands[5], operands[1])
+           && rtx_equal_p (operands[2], operands[0])))"
+  [(set (match_dup 2) (match_dup 1))
+   (set (match_dup 2) (plus:HI (match_dup 2) (match_dup 3)))
+   (set (match_dup 4) (match_dup 2))
+   (set (cc0) (compare (match_dup 2) (match_dup 3)))]
+  "")
+
+
+;;--------------------------------------------------------------------
+;;- Load peephole2
+;;--------------------------------------------------------------------
+;;
+;; Optimize initialization of 2 hard regs from the same memory location
+;; Since we can't copy easily X, Y and D to each other, load the 2 registers
+;; from the same memory location.
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+	(match_operand:HI 1 "memory_operand" ""))
+   (set (match_operand:HI 2 "hard_reg_operand" "") (match_dup 0))]
+  "TARGET_M6811
+   && !side_effects_p (operands[1])
+   && !reg_mentioned_p (operands[0], operands[1])"
+  [(set (match_dup 0) (match_dup 1))
+   (set (match_dup 2) (match_dup 1))]
+  "")
+
+;; Replace "ldd #N; addd <op>" with "ldd <op>; addd #N".
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "nonimmediate_operand" "") (const_int 0))
+   (set (match_operand:HI 1 "nonimmediate_operand" "") (const_int 0))
+   (set (match_operand:HI 2 "nonimmediate_operand" "") (const_int 0))
+   (set (match_operand:HI 3 "nonimmediate_operand" "") (const_int 0))
+   (match_scratch:HI 4 "d")]
+  ""
+  [(set (match_dup 4) (const_int 0))
+   (set (match_dup 0) (match_dup 4))
+   (set (match_dup 1) (match_dup 4))
+   (set (match_dup 2) (match_dup 4))
+   (set (match_dup 3) (match_dup 4))]
+  "")
+
+;;
+;; Replace "ldd #N; addd <op>" with "ldd <op>; addd #N".
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "nonimmediate_operand" "") (const_int 0))
+   (set (match_operand:HI 1 "nonimmediate_operand" "") (const_int 0))
+   (set (match_operand:HI 2 "nonimmediate_operand" "") (const_int 0))
+   (match_scratch:HI 3 "d")]
+  ""
+  [(set (match_dup 3) (const_int 0))
+   (set (match_dup 0) (match_dup 3))
+   (set (match_dup 1) (match_dup 3))
+   (set (match_dup 2) (match_dup 3))]
+  "")
+
+;;
+;; Replace "ldd #N; addd <op>" with "ldd <op>; addd #N".
+;;
+(define_peephole2
+  [(set (match_operand:HI 0 "hard_reg_operand" "") (const_int 0))
+   (set (match_operand:HI 1 "push_operand" "") (match_dup 0))
+   (set (match_operand:HI 2 "push_operand" "") (match_dup 0))
+   (set (match_operand:HI 3 "push_operand" "") (match_dup 0))
+   (match_scratch:HI 4 "x")]
+  "TARGET_M6811 && D_REG_P (operands[0]) && peep2_reg_dead_p (4, operands[0])"
+  [(set (match_dup 4) (const_int 0))
+   (set (match_dup 1) (match_dup 4))
+   (set (match_dup 2) (match_dup 4))
+   (set (match_dup 3) (match_dup 4))]
+  "")
+
 ;;
 ;; This peephole catches the address computations generated by the reload
 ;; pass. 
@@ -7189,6 +7643,8 @@
 }
 ")
 
+;; SCz 2005-04-03: this peephole is not valid anymore because it appears
+;; we can't rely on the REG_DEAD note
 (define_peephole
   [(set (match_operand:HI 0 "hard_reg_operand" "h")
 	(match_operand:HI 1 "non_push_operand" "g"))
@@ -7279,7 +7735,7 @@
 
 ;;;
 ;;; Catch an xgdx/xgdy followed by a (set D X/Y). If X/Y is dead, we don't
-;;; need to emit anything. Otherwise, we just need an copy of D to X/Y.
+;;; need to emit anything. Otherwise, we just need a copy of D to X/Y.
 ;;;
 (define_peephole
   [(parallel [(set (reg:HI D_REGNUM) (match_operand:HI 0 "hard_reg_operand" "A"))
@@ -7295,7 +7751,7 @@
 
 ;;;
 ;;; Catch an xgdx/xgdy followed by a (set D X/Y). If X/Y is dead, we don't
-;;; need to emit anything. Otherwise, we just need an copy of D to X/Y.
+;;; need to emit anything. Otherwise, we just need a copy of D to X/Y.
 ;;;
 (define_peephole
   [(parallel [(set (reg:HI D_REGNUM) (match_operand:HI 0 "hard_reg_operand" "A"))
@@ -7400,3 +7856,41 @@
   return \"sts\\t%t0\\n\\tld%0\\t%t0\";
 }
 ")
+
+(define_peephole
+  [(set (match_operand:HI 0 "hard_reg_operand" "")
+	(match_operand:HI 1 "memory_operand" ""))
+   (set (match_operand:HI 2 "hard_reg_operand" "") (match_dup 0))]
+  "TARGET_M6811
+   && !side_effects_p (operands[1])
+   && !reg_mentioned_p (operands[0], operands[1])"
+  "*
+{
+  rtx ops[2];
+
+  ops[0] = operands[0];
+  ops[1] = operands[1];
+  m68hc11_gen_movhi (insn, ops);
+  ops[0] = operands[2];
+  m68hc11_gen_movhi (insn, ops);
+  return \"\";
+}")
+
+;; Peephole for Z register replacement.
+;; Avoid to use _.tmp register when comparing D and X if we can compare
+;; with soft register
+(define_peephole
+  [(set (match_operand:HI 0 "hard_reg_operand" "") (reg:HI SOFT_XY_REGNUM))
+   (set (reg:HI SOFT_TMP_REGNUM) (match_dup 0))
+   (set (cc0) (compare (match_operand:HI 2 "hard_reg_operand" "")
+                       (reg:HI SOFT_TMP_REGNUM)))]
+  "X_REG_P (operands[0]) || Y_REG_P (operands[0])"
+  "*
+{
+  rtx ops[2];
+
+  ops[0] = operands[0];
+  ops[1] = operands[1];
+  m68hc11_gen_movhi (insn, ops);
+  return \"cp%2\\t%1\";
+}")
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/m68hc11/t-m68hc11-gas gcc-3.3.6-m68hc1x/gcc/config/m68hc11/t-m68hc11-gas
--- gcc-3.3.6/gcc/config/m68hc11/t-m68hc11-gas	Fri Jan 28 23:21:39 2005
+++ gcc-3.3.6-m68hc1x/gcc/config/m68hc11/t-m68hc11-gas	Sat Nov  5 19:17:25 2005
@@ -37,7 +37,7 @@ LIB2FUNCS_EXTRA = $(srcdir)/config/udivm
 LIBGCC2_DEBUG_CFLAGS =-g
 LIBGCC2_CFLAGS = -Os -mrelax $(LIBGCC2_INCLUDES) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2
 
-MULTILIB_OPTIONS  = m68hc11/m68hc12 mshort fshort-double
+MULTILIB_OPTIONS  = m68hc11/m68hc12 mshort fshort-double mlong-calls
 MULTILIB_DIRNAMES =
 MULTILIB_MATCHES  = m68hc11=m6811 m68hc12=m6812 m68hc12=m68hcs12
 MULTILIB_EXCEPTIONS = -mnoshort -mno68hc11
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/udivmod.c gcc-3.3.6-m68hc1x/gcc/config/udivmod.c
--- gcc-3.3.6/gcc/config/udivmod.c	Thu Nov 30 09:25:58 2000
+++ gcc-3.3.6-m68hc1x/gcc/config/udivmod.c	Sat Nov  5 19:17:25 2005
@@ -1,14 +1,18 @@
-long udivmodsi4 ();
+extern unsigned long __udivmodsi4 (unsigned long num, unsigned long den,
+                                   unsigned long *mod);
 
-long
-__udivsi3 (long a, long b)
+unsigned long
+__udivsi3 (unsigned long a, unsigned long b)
 {
-  return udivmodsi4 (a, b, 0);
+  return __udivmodsi4 (a, b, 0);
 }
 
-long
-__umodsi3 (long a, long b)
+unsigned long
+__umodsi3 (unsigned long a, unsigned long b)
 {
-  return udivmodsi4 (a, b, 1);
+  unsigned long mod;
+
+  __udivmodsi4 (a, b, &mod);
+  return mod;
 }
 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/config/udivmodsi4.c gcc-3.3.6-m68hc1x/gcc/config/udivmodsi4.c
--- gcc-3.3.6/gcc/config/udivmodsi4.c	Thu Nov 30 09:25:58 2000
+++ gcc-3.3.6-m68hc1x/gcc/config/udivmodsi4.c	Sat Nov  5 19:17:25 2005
@@ -1,10 +1,57 @@
 unsigned long
-udivmodsi4(unsigned long num, unsigned long den, int modwanted)
+__udivmodsi4 (unsigned long num, unsigned long den, unsigned long* mod)
 {
-  unsigned long bit = 1;
-  unsigned long res = 0;
+  unsigned long bit;
+  unsigned long res;
+  
+  if ((unsigned short) (den >> 16) == 0)
+    {
+#ifdef mc68hc11
+      if ((unsigned short) (num >> 16) == 0)
+        {
+          /* Both numbers are 16-bit quantities, use 16-bit div/mod.  */
+          unsigned short sden = (unsigned short) den;
+          unsigned short snum = (unsigned short) num;
+          unsigned short sres = snum / sden;
+          unsigned short smod = snum % sden;;
+
+          if (mod)
+            *mod = (unsigned long) smod;
+          return (unsigned long) sres;
+        }
+#endif
+#ifdef mc68hc12
+        {
+          /* To avoid to stress the gcc reload, use + operand modifier
+             and pass the input values in the same variables as the
+             outputs.  */
+          unsigned short status = (unsigned short) den;
+          unsigned short smod = (unsigned short) (num & 0x0ffff);
+          unsigned short sres = (unsigned short) (num >> 16);
 
-  while (den < num && bit && !(den & (1L<<31)))
+          __asm__ __volatile__ ("ediv\n"
+                                "tfr ccr,x"
+                                : "+x" (status), "+y" (sres),
+                                  "+d" (smod));
+          /* check for overflow */
+          if (!(status & 0x03))
+            {
+              if (mod)
+                *mod = (unsigned long) smod;
+              return (unsigned long) sres;
+            }
+        }
+#endif
+      if ((unsigned short) den == 0)
+        {
+          if (mod)
+            *mod = 0;
+          return 0;
+        }
+    }
+  bit = 1;
+  res = 0;
+  while (den < num && !((unsigned short) (den >> 16) & (1L<<15)))
     {
       den <<=1;
       bit <<=1;
@@ -19,6 +66,25 @@ udivmodsi4(unsigned long num, unsigned l
       bit >>=1;
       den >>=1;
     }
-  if (modwanted) return num;
+  if (mod)
+    *mod = num;
   return res;
 }
+
+#ifdef L_udivmodsi4
+unsigned long
+udivmodsi4 (unsigned long num, unsigned long den, int modwanted)
+{
+  unsigned long mod;
+
+  if (modwanted)
+    {
+      __udivmodsi4 (num, den, &mod);
+      return mod;
+    }
+  else
+    {
+      return __udivmodsi4 (num, den, 0);
+    }
+}
+#endif
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/cppdefault.c gcc-3.3.6-m68hc1x/gcc/cppdefault.c
--- gcc-3.3.6/gcc/cppdefault.c	Fri Nov  7 00:13:31 2003
+++ gcc-3.3.6-m68hc1x/gcc/cppdefault.c	Sat Nov  5 19:17:25 2005
@@ -76,10 +76,14 @@ const struct default_include cpp_include
 
 #ifdef GCC_INCLUDE_DIR
 const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR;
+#if GNU_HC1X_DONT_PATCH
 const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
+#endif
 #else
 const char cpp_GCC_INCLUDE_DIR[] = "";
+#if GNU_HC1X_DONT_PATCH
 const size_t cpp_GCC_INCLUDE_DIR_len = 0;
+#endif
 #endif
 
 #ifdef TARGET_SYSTEM_ROOT
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/cppdefault.h gcc-3.3.6-m68hc1x/gcc/cppdefault.h
--- gcc-3.3.6/gcc/cppdefault.h	Fri Nov  7 00:13:31 2003
+++ gcc-3.3.6-m68hc1x/gcc/cppdefault.h	Sat Nov  5 19:17:25 2005
@@ -67,7 +67,17 @@ struct default_include
 
 extern const struct default_include cpp_include_defaults[];
 extern const char cpp_GCC_INCLUDE_DIR[];
+
+/* Don't use sizeof GCC_INCLUDE_DIR because for Mingw32 we patch the
+   executable to replace this path with the good path.  We must then
+   use strlen() to find the correct length.  */
+#undef GNU_HC1X_DONT_PATCH
+#if GNU_HC1X_DONT_PATCH
 extern const size_t cpp_GCC_INCLUDE_DIR_len;
+#else
+#define cpp_GCC_INCLUDE_DIR_len \
+(strlen (cpp_GCC_INCLUDE_DIR) > 7 ? strlen (cpp_GCC_INCLUDE_DIR) - 7 : 0)
+#endif
 
 extern const char *cpp_SYSROOT;
 
+timestamp
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/expmed.c gcc-3.3.6-m68hc1x/gcc/expmed.c
--- gcc-3.3.6/gcc/expmed.c	Sat Apr 30 18:01:29 2005
+++ gcc-3.3.6-m68hc1x/gcc/expmed.c	Sat Nov  5 22:00:59 2005
@@ -474,6 +474,15 @@ store_bit_field (str_rtx, bitsize, bitnu
 	 result in an abort.  */
       fieldmode = smallest_mode_for_size (nwords * BITS_PER_WORD, MODE_INT);
 
+      /* When the value is a constant, the constant_subword applies a
+         correction on big endian targets.  If the bitfield contains less words
+         than the value (fieldmode), the constant that is extracted is shifted
+         by the word difference.  Example: bitfield = 33, fieldmode = DImode
+         and constant_subword extracts word 1 2 3 instead of 0 1 2.  */
+      int correction = 0;
+      if (WORDS_BIG_ENDIAN && CONSTANT_P (value))
+        correction = GET_MODE_BITSIZE (fieldmode) / BITS_PER_WORD - nwords;
+
       for (i = 0; i < nwords; i++)
 	{
 	  /* If I is 0, use the low-order word in both field and target;
@@ -488,7 +497,7 @@ store_bit_field (str_rtx, bitsize, bitnu
 	  store_bit_field (op0, MIN (BITS_PER_WORD,
 				     bitsize - i * BITS_PER_WORD),
 			   bitnum + bit_offset, word_mode,
-			   operand_subword_force (value, wordnum,
+			   operand_subword_force (value, correction + wordnum,
 						  (GET_MODE (value) == VOIDmode
 						   ? fieldmode
 						   : GET_MODE (value))),
@@ -2142,7 +2151,7 @@ synth_mult (alg_out, t, cost_limit)
   if ((t & 1) == 0)
     {
       m = floor_log2 (t & -t);	/* m = number of low zero bits */
-      if (m < BITS_PER_WORD)
+      if (m < MAX_BITS_PER_WORD)
 	{
 	  q = t >> m;
 	  cost = shift_cost[m];
@@ -2227,7 +2236,7 @@ synth_mult (alg_out, t, cost_limit)
       unsigned HOST_WIDE_INT d;
 
       d = ((unsigned HOST_WIDE_INT) 1 << m) + 1;
-      if (t % d == 0 && t > d && m < BITS_PER_WORD)
+      if (t % d == 0 && t > d && m < MAX_BITS_PER_WORD)
 	{
 	  cost = MIN (shiftadd_cost[m], add_cost + shift_cost[m]);
 	  synth_mult (alg_in, t / d, cost_limit - cost);
@@ -2246,7 +2255,7 @@ synth_mult (alg_out, t, cost_limit)
 	}
 
       d = ((unsigned HOST_WIDE_INT) 1 << m) - 1;
-      if (t % d == 0 && t > d && m < BITS_PER_WORD)
+      if (t % d == 0 && t > d && m < MAX_BITS_PER_WORD)
 	{
 	  cost = MIN (shiftsub_cost[m], add_cost + shift_cost[m]);
 	  synth_mult (alg_in, t / d, cost_limit - cost);
@@ -2271,7 +2280,7 @@ synth_mult (alg_out, t, cost_limit)
       q = t - 1;
       q = q & -q;
       m = exact_log2 (q);
-      if (m >= 0 && m < BITS_PER_WORD)
+      if (m >= 0 && m < MAX_BITS_PER_WORD)
 	{
 	  cost = shiftadd_cost[m];
 	  synth_mult (alg_in, (t - 1) >> m, cost_limit - cost);
@@ -2290,7 +2299,7 @@ synth_mult (alg_out, t, cost_limit)
       q = t + 1;
       q = q & -q;
       m = exact_log2 (q);
-      if (m >= 0 && m < BITS_PER_WORD)
+      if (m >= 0 && m < MAX_BITS_PER_WORD)
 	{
 	  cost = shiftsub_cost[m];
 	  synth_mult (alg_in, (t + 1) >> m, cost_limit - cost);
@@ -2793,7 +2802,7 @@ expand_mult_highpart (mode, op0, cnst1, 
 
   /* expand_mult handles constant multiplication of word_mode
      or narrower.  It does a poor job for large modes.  */
-  if (size < BITS_PER_WORD
+  if (size < MAX_BITS_PER_WORD
       && mul_cost[(int) wider_mode] + shift_cost[size-1] < max_cost)
     {
       /* We have to do this, since expand_binop doesn't do conversion for
@@ -2824,7 +2833,7 @@ expand_mult_highpart (mode, op0, cnst1, 
 
   /* Secondly, same as above, but use sign flavor opposite of unsignedp.
      Need to adjust the result after the multiplication.  */
-  if (size - 1 < BITS_PER_WORD
+  if (size - 1 < MAX_BITS_PER_WORD
       && (mul_highpart_cost[(int) mode] + 2 * shift_cost[size-1] + 4 * add_cost
 	  < max_cost))
     {
@@ -2849,7 +2858,7 @@ expand_mult_highpart (mode, op0, cnst1, 
   /* Try widening the mode and perform a non-widening multiplication.  */
   moptab = smul_optab;
   if (smul_optab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing
-      && size - 1 < BITS_PER_WORD
+      && size - 1 < MAX_BITS_PER_WORD
       && mul_cost[(int) wider_mode] + shift_cost[size-1] < max_cost)
     {
       op1 = wide_op1;
@@ -2859,7 +2868,7 @@ expand_mult_highpart (mode, op0, cnst1, 
   /* Try widening multiplication of opposite signedness, and adjust.  */
   moptab = unsignedp ? smul_widen_optab : umul_widen_optab;
   if (moptab->handlers[(int) wider_mode].insn_code != CODE_FOR_nothing
-      && size - 1 < BITS_PER_WORD
+      && size - 1 < MAX_BITS_PER_WORD
       && (mul_widen_cost[(int) wider_mode]
 	  + 2 * shift_cost[size-1] + 4 * add_cost < max_cost))
     {
@@ -3199,7 +3208,7 @@ expand_divmod (rem_flag, code, mode, op0
 			  {
 			    rtx t1, t2, t3, t4;
 
-			    if (post_shift - 1 >= BITS_PER_WORD)
+			    if (post_shift - 1 >= MAX_BITS_PER_WORD)
 			      goto fail1;
 
 			    extra_cost = (shift_cost[post_shift - 1]
@@ -3226,8 +3235,8 @@ expand_divmod (rem_flag, code, mode, op0
 			  {
 			    rtx t1, t2;
 
-			    if (pre_shift >= BITS_PER_WORD
-				|| post_shift >= BITS_PER_WORD)
+			    if (pre_shift >= MAX_BITS_PER_WORD
+				|| post_shift >= MAX_BITS_PER_WORD)
 			      goto fail1;
 
 			    t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
@@ -3363,8 +3372,8 @@ expand_divmod (rem_flag, code, mode, op0
 		      {
 			rtx t1, t2, t3;
 
-			if (post_shift >= BITS_PER_WORD
-			    || size - 1 >= BITS_PER_WORD)
+			if (post_shift >= MAX_BITS_PER_WORD
+			    || size - 1 >= MAX_BITS_PER_WORD)
 			  goto fail1;
 
 			extra_cost = (shift_cost[post_shift]
@@ -3393,8 +3402,8 @@ expand_divmod (rem_flag, code, mode, op0
 		      {
 			rtx t1, t2, t3, t4;
 
-			if (post_shift >= BITS_PER_WORD
-			    || size - 1 >= BITS_PER_WORD)
+			if (post_shift >= MAX_BITS_PER_WORD
+			    || size - 1 >= MAX_BITS_PER_WORD)
 			  goto fail1;
 
 			ml |= (~(unsigned HOST_WIDE_INT) 0) << (size - 1);
@@ -3480,8 +3489,8 @@ expand_divmod (rem_flag, code, mode, op0
 		    if (mh)
 		      abort ();
 
-		    if (post_shift < BITS_PER_WORD
-			&& size - 1 < BITS_PER_WORD)
+		    if (post_shift < MAX_BITS_PER_WORD
+			&& size - 1 < MAX_BITS_PER_WORD)
 		      {
 			t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
 					   build_int_2 (size - 1, 0),
@@ -4135,8 +4144,12 @@ make_tree (type, x)
 
     case SIGN_EXTEND:
     case ZERO_EXTEND:
-      t = (*lang_hooks.types.type_for_mode) (GET_MODE (XEXP (x, 0)),
-					     GET_CODE (x) == ZERO_EXTEND);
+      if (CONSTANT_P (XEXP (x, 0)))
+        t = (*lang_hooks.types.type_for_mode) (GET_MODE (x),
+					       GET_CODE (x) == ZERO_EXTEND);
+      else
+        t = (*lang_hooks.types.type_for_mode) (GET_MODE (XEXP (x, 0)),
+					       GET_CODE (x) == ZERO_EXTEND);
       return fold (convert (type, make_tree (t, XEXP (x, 0))));
 
    default:
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/final.c gcc-3.3.6-m68hc1x/gcc/final.c
--- gcc-3.3.6/gcc/final.c	Mon Dec  1 09:18:36 2003
+++ gcc-3.3.6-m68hc1x/gcc/final.c	Sat Nov  5 19:17:25 2005
@@ -2909,7 +2909,22 @@ alter_subreg (xp)
   /* simplify_subreg does not remove subreg from volatile references.
      We are required to.  */
   if (GET_CODE (y) == MEM)
-    *xp = adjust_address (y, GET_MODE (x), SUBREG_BYTE (x));
+    {
+      unsigned outer_size = GET_MODE_SIZE (GET_MODE (x));
+      unsigned inner_size = GET_MODE_SIZE (GET_MODE (y));
+      int offset = SUBREG_BYTE (x);
+      
+      /* If this is a paradoxical subreg with a SUBREG_BYTE set
+         to 0 we must adjust the offset for big-endian machines
+         (otherwise we take the address of the high part).  */
+      if (BYTES_BIG_ENDIAN && !offset && outer_size > inner_size)
+        {
+          offset += MIN (inner_size, UNITS_PER_WORD);
+          offset -= MIN (outer_size, UNITS_PER_WORD);
+        }
+
+      *xp = adjust_address (y, GET_MODE (x), offset);
+    }
   else
     {
       rtx new = simplify_subreg (GET_MODE (x), y, GET_MODE (y),
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/flow.c gcc-3.3.6-m68hc1x/gcc/flow.c
--- gcc-3.3.6/gcc/flow.c	Sat Dec  4 01:36:35 2004
+++ gcc-3.3.6-m68hc1x/gcc/flow.c	Sat Nov  5 19:17:25 2005
@@ -571,7 +571,7 @@ verify_local_live_at_start (new_live_at_
 	      fputs ("Old:\n", rtl_dump_file);
 	      dump_bb (bb, rtl_dump_file);
 	    }
-	  abort ();
+	  // SCz: abort ();
 	}
     }
   else
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/gcse.c gcc-3.3.6-m68hc1x/gcc/gcse.c
--- gcc-3.3.6/gcc/gcse.c	Sat Dec 20 20:59:50 2003
+++ gcc-3.3.6-m68hc1x/gcc/gcse.c	Sat Nov  5 19:17:25 2005
@@ -3513,8 +3513,7 @@ handle_avail_expr (insn, expr)
       /* ??? If the change fails, we return 0, even though we created
 	 an insn.  I think this is ok.  */
       new_insn
-	= emit_insn_after (gen_rtx_SET (VOIDmode, to,
-					SET_DEST (expr_set)),
+	= emit_insn_after (gen_move_insn (to, SET_DEST (expr_set)),
 			   insn_computes_expr);
 
       /* Keep register set table up to date.  */
@@ -3525,7 +3524,7 @@ handle_avail_expr (insn, expr)
 	{
 	  fprintf (gcse_file, "GCSE: Creating insn %d to copy value of reg %d",
 		   INSN_UID (NEXT_INSN (insn_computes_expr)),
-		   REGNO (SET_SRC (PATTERN (NEXT_INSN (insn_computes_expr)))));
+		   REGNO (SET_DEST (expr_set)));
 	  fprintf (gcse_file, ", computed in insn %d,\n",
 		   INSN_UID (insn_computes_expr));
 	  fprintf (gcse_file, "      into newly allocated reg %d\n",
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/libgcc2.c gcc-3.3.6-m68hc1x/gcc/libgcc2.c
--- gcc-3.3.6/gcc/libgcc2.c	Wed Oct 23 12:47:24 2002
+++ gcc-3.3.6-m68hc1x/gcc/libgcc2.c	Sat Nov  5 19:17:25 2005
@@ -490,7 +490,12 @@ __udiv_w_sdiv (UWtype *rp __attribute__ 
 
 #if (defined (L_udivdi3) || defined (L_divdi3) || \
      defined (L_umoddi3) || defined (L_moddi3))
-#define L_udivmoddi4
+#if !defined(mc6811) && !defined(mc6812)
+# define L_udivmoddi4
+#else
+extern UDWtype
+__udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp);
+#endif
 #endif
 
 #ifdef L_clz
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/longlong.h gcc-3.3.6-m68hc1x/gcc/longlong.h
--- gcc-3.3.6/gcc/longlong.h	Thu Oct  3 22:39:08 2002
+++ gcc-3.3.6-m68hc1x/gcc/longlong.h	Sat Nov  5 19:17:25 2005
@@ -1162,6 +1162,67 @@ UDItype __umulsidi3 (USItype, USItype);
 
 #endif /* __GNUC__ */
 
+#if defined(mc6811) || defined(mc6812)
+#define sub_ddmmss(sh, sl, ah, al, bh, bl)				\
+  do {									\
+    __asm__ ("subd 2+%2\n"						\
+             "\txgdx\n"							\
+             "\tsbcb 1+%2\n"						\
+             "\tsbca %2\n"						\
+             "\txgdx" : "=D"((USItype) (sl))				\
+		      : "0"((USItype) (al)), "m"((USItype) (bl)));	\
+    /* Assumes that the carry is not modified. */			\
+    /* which is true since the reload instructions */			\
+    /* generated between the two __asm__ only do load/store.  */	\
+    __asm__ ("sbcb 3+%2\n"						\
+             "\tsbca 2+%2\n"						\
+             "\txgdx\n"							\
+             "\tsbcb 1+%2\n"						\
+             "\tsbca %2\n"						\
+             "\txgdx" : "=D"((USItype) (sh))				\
+		      : "0"((USItype) (ah)), "m"((USItype) (bh)));	\
+  } while (0)
+#if defined(mc6812)
+#define umul_ppmm(w1, w0, u, v)						\
+  do {									\
+    UWtype __x0, __x1, __x2, __x3;					\
+									\
+    __x0 = ((UWtype) ((UHItype) __ll_lowpart (u))) * ((UWtype) ((UHItype) __ll_lowpart (v)));	\
+    __x1 = ((UWtype) ((UHItype) __ll_lowpart (u))) * ((UWtype) ((UHItype) __ll_highpart (v)));	\
+    __x2 = ((UWtype) ((UHItype) __ll_highpart (u))) * ((UWtype) ((UHItype) __ll_lowpart (v)));	\
+    __x3 = ((UWtype) ((UHItype) __ll_highpart (u))) * ((UWtype) ((UHItype) __ll_highpart (v)));	\
+									\
+    __x1 += __ll_highpart (__x0);/* this can't give carry */		\
+    __x1 += __x2;		/* but this indeed can */		\
+    __asm__ ("bcc 1f\n"                                                 \
+	     "\tinx\n"							\
+	     "1:" : "=D"(__x3) : "0"(__x3));				\
+									\
+    (w1) = __x3 + __ll_highpart (__x1);					\
+    (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0);		\
+  } while (0)
+#else
+#define umul_ppmm(w1, w0, u, v)						\
+  do {									\
+    UWtype __x0, __x1, __x2, __x3;					\
+    extern UWtype __attribute__((near)) __mulhi32 (UHItype, UHItype);	\
+									\
+    __x0 = __mulhi32 (__ll_lowpart (u), __ll_lowpart (v));		\
+    __x1 = __mulhi32 (__ll_lowpart (u), __ll_highpart (v));		\
+    __x2 = __mulhi32 (__ll_highpart (u), __ll_lowpart (v));		\
+    __x3 = __mulhi32 (__ll_highpart (u), __ll_highpart (v));		\
+									\
+    __x1 += __ll_highpart (__x0);/* this can't give carry */		\
+    __x1 += __x2;		/* but this indeed can */		\
+    __asm__ ("bcc 1f\n"                                                 \
+	     "\tinx\n"							\
+	     "1:" : "=D"(__x3) : "0"(__x3));				\
+									\
+    (w1) = __x3 + __ll_highpart (__x1);					\
+    (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0);		\
+  } while (0)
+#endif
+#endif     
 /* If this machine has no inline assembler, use C macros.  */
 
 #if !defined (add_ssaaaa)
@@ -1232,6 +1293,45 @@ UDItype __umulsidi3 (USItype, USItype);
 #endif
 
 /* Define this unconditionally, so it can be used for debugging.  */
+#if defined(mc6811) || defined(mc6812)
+extern USItype __udivmodsi4(USItype num, USItype den, USItype* mod);
+
+#define __udiv_qrnnd_c(q, r, n1, n0, d) \
+  do {									\
+    USItype __d1, __d0, __q1, __q0;					\
+    USItype __r0, __m;						\
+    __d1 = __ll_highpart (d);						\
+    __d0 = __ll_lowpart (d);						\
+									\
+    __q1 = __udivmodsi4 (n1,__d1,&__r0);				\
+    __m = (USItype) __q1 * __d0;					\
+    __r0 = __r0 * __ll_B | __ll_highpart (n0);				\
+    if (__r0 < __m)							\
+      {									\
+	__q1--, __r0 += (d);						\
+	if (__r0 >= (d)) /* i.e. we didn't get carry when adding to __r0 */\
+	  if (__r0 < __m)						\
+	    __q1--, __r0 += (d);					\
+      }									\
+    __r0 -= __m;							\
+									\
+    __q0 = __udivmodsi4 (__r0,__d1,&__r0);				\
+    __m = (USItype) __q0 * __d0;					\
+    __r0 = __r0 * __ll_B | __ll_lowpart (n0);				\
+    if (__r0 < __m)							\
+      {									\
+	__q0--, __r0 += (d);						\
+	if (__r0 >= (d))						\
+	  if (__r0 < __m)						\
+	    __q0--, __r0 += (d);					\
+      }									\
+    __r0 -= __m;							\
+									\
+    (q) = (USItype) __q1 * __ll_B | __q0;				\
+    (r) = __r0;								\
+  } while (0)
+#else
+/* Define this unconditionally, so it can be used for debugging.  */
 #define __udiv_qrnnd_c(q, r, n1, n0, d) \
   do {									\
     UWtype __d1, __d0, __q1, __q0;					\
@@ -1268,6 +1368,7 @@ UDItype __umulsidi3 (USItype, USItype);
     (q) = (UWtype) __q1 * __ll_B | __q0;				\
     (r) = __r0;								\
   } while (0)
+#endif
 
 /* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through
    __udiv_w_sdiv (defined in libgcc or elsewhere).  */
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/loop.c gcc-3.3.6-m68hc1x/gcc/loop.c
--- gcc-3.3.6/gcc/loop.c	Sun May 30 01:27:30 2004
+++ gcc-3.3.6-m68hc1x/gcc/loop.c	Sat Nov  5 19:17:25 2005
@@ -4703,7 +4703,8 @@ loop_givs_reduce (loop, bl)
 	     this is an address giv, then try to put the increment
 	     immediately after its use, so that flow can create an
 	     auto-increment addressing mode.  */
-	  if (v->giv_type == DEST_ADDR && bl->biv_count == 1
+	  if ((HAVE_POST_INCREMENT || HAVE_POST_DECREMENT)
+              && v->giv_type == DEST_ADDR && bl->biv_count == 1
 	      && bl->biv->always_executed && ! bl->biv->maybe_multiple
 	      /* We don't handle reversed biv's because bl->biv->insn
 		 does not have a valid INSN_LUID.  */
@@ -8979,7 +8980,13 @@ maybe_eliminate_biv_1 (loop, x, insn, bl
 		    || (GET_CODE (v->add_val) == REG
 			&& REG_POINTER (v->add_val)))
 		&& ! v->ignore && ! v->maybe_dead && v->always_computable
-		&& v->mode == mode)
+		&& v->mode == mode
+                /* SCz: There is a possible overflow here.
+                   If we compare to a constant value, the constant is
+                   re-computed (CST * mult_add + add_val) and there may
+                   be an overflow. CST was 16399, mult was 8, and integers
+                   are 16-bits.   (execute/loop-3c.c, -Os -mshort).  */
+                && 0)
 	      {
 		if (! biv_elimination_giv_has_0_offset (bl->biv, v, insn))
 		  continue;
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/regrename.c gcc-3.3.6-m68hc1x/gcc/regrename.c
--- gcc-3.3.6/gcc/regrename.c	Mon Nov  4 17:57:02 2002
+++ gcc-3.3.6-m68hc1x/gcc/regrename.c	Sat Nov  5 19:17:25 2005
@@ -102,6 +102,9 @@ note_sets (x, set, data)
   HARD_REG_SET *pset = (HARD_REG_SET *) data;
   unsigned int regno;
   int nregs;
+
+  if (GET_CODE (x) == SUBREG)
+    x = SUBREG_REG (x);
   if (GET_CODE (x) != REG)
     return;
   regno = REGNO (x);
@@ -292,6 +295,7 @@ regrename_optimize ()
 	  for (new_reg = 0; new_reg < FIRST_PSEUDO_REGISTER; new_reg++)
 	    {
 	      int nregs = HARD_REGNO_NREGS (new_reg, GET_MODE (*this->loc));
+              int mode = GET_MODE (*this->loc);
 
 	      for (i = nregs - 1; i >= 0; --i)
 	        if (TEST_HARD_REG_BIT (this_unavailable, new_reg + i)
@@ -307,7 +311,7 @@ regrename_optimize ()
 			&& !LEAF_REGISTERS[new_reg + i])
 #endif
 #ifdef HARD_REGNO_RENAME_OK
-		    || ! HARD_REGNO_RENAME_OK (reg + i, new_reg + i)
+		    || ! HARD_REGNO_RENAME_OK (reg + i, new_reg + i, mode)
 #endif
 		    )
 		  break;
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/reload.c gcc-3.3.6-m68hc1x/gcc/reload.c
--- gcc-3.3.6/gcc/reload.c	Fri Mar  5 18:09:34 2004
+++ gcc-3.3.6-m68hc1x/gcc/reload.c	Sun Jan 22 21:14:21 2006
@@ -4216,6 +4216,20 @@ find_reloads (insn, replace, ind_levels,
 
       if (goal_alternative_matches[rld[i].opnum] >= 0)
 	rld[i].opnum = goal_alternative_matches[rld[i].opnum];
+
+      /* If an operand's reload is RELOAD_OTHER, change any
+         RELOAD_FOR_OPERAND_ADDRESS and RELOAD_FOR_OUTPUT_ADDRESS reloads
+         of that operand to RELOAD_FOR_OTHER_ADDRESS.  This is necessary
+         to make sure the reloads are emitted in the good order.  We only need
+         to scan backward.  */
+      if (rld[i].when_needed == RELOAD_OTHER
+          && rld[i].optional == 0)
+        {
+          for (j = i - 1; j >= 0; j--)
+            if (rld[j].opnum == rld[i].opnum
+                && rld[j].when_needed == RELOAD_FOR_OPERAND_ADDRESS)
+              rld[j].when_needed = RELOAD_FOR_OTHER_ADDRESS;
+        }
     }
 
   /* Scan all the reloads, and check for RELOAD_FOR_OPERAND_ADDRESS reloads.
@@ -4556,10 +4570,8 @@ find_reloads_toplev (x, opnum, type, ind
 	 force a reload in that case.  So we should not do anything here.  */
 
       else if (regno >= FIRST_PSEUDO_REGISTER
-#ifdef LOAD_EXTEND_OP
 	       && (GET_MODE_SIZE (GET_MODE (x))
 		   <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
-#endif
 	       && (reg_equiv_address[regno] != 0
 		   || (reg_equiv_mem[regno] != 0
 		       && (! strict_memory_address_p (GET_MODE (x),
@@ -5913,7 +5925,7 @@ find_reloads_subreg_address (x, force_re
 		}
 
 	      find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
-				    &XEXP (tem, 0), opnum, ADDR_TYPE (type),
+				    &XEXP (tem, 0), opnum, type,
 				    ind_levels, insn);
 
 	      /* If this is not a toplevel operand, find_reloads doesn't see
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/reload1.c gcc-3.3.6-m68hc1x/gcc/reload1.c
--- gcc-3.3.6/gcc/reload1.c	Fri Nov 26 06:08:45 2004
+++ gcc-3.3.6-m68hc1x/gcc/reload1.c	Mon Jan 23 21:53:40 2006
@@ -1777,9 +1777,6 @@ find_reg (chain, order)
   if (best_reg == -1)
     return 0;
 
-  if (rtl_dump_file)
-    fprintf (rtl_dump_file, "Using reg %d for reload %d\n", best_reg, rnum);
-
   rl->nregs = HARD_REGNO_NREGS (best_reg, rl->mode);
   rl->regno = best_reg;
 
@@ -1930,6 +1927,7 @@ spill_failure (insn, class)
     {
       error ("unable to find a register to spill in class `%s'",
 	     reg_class_names[class]);
+
       fatal_insn ("this is the insn:", insn);
     }
 }
@@ -3979,7 +3977,7 @@ reload_as_needed (live_known)
 	     for this insn in order to be stored in
 	     (obeying register constraints).  That is correct; such reload
 	     registers ARE still valid.  */
-	  note_stores (oldpat, forget_old_reloads_1, NULL);
+         note_stores (oldpat, forget_old_reloads_1, NULL);
 
 	  /* There may have been CLOBBER insns placed after INSN.  So scan
 	     between INSN and NEXT and use them to forget old reloads.  */
@@ -4580,6 +4578,9 @@ reload_reg_reaches_end_p (regno, opnum, 
     case RELOAD_OTHER:
       /* Since a RELOAD_OTHER reload claims the reg for the entire insn,
 	 its value must reach the end.  */
+      for (i = 0; i < reload_n_operands; i++)
+        if (TEST_HARD_REG_BIT (reload_reg_used_in_output[i], regno))
+          return 0;
       return 1;
 
       /* If this use is for part of the insn,
@@ -5298,6 +5299,13 @@ choose_reload_regs_init (chain, save_rel
   CLEAR_HARD_REG_SET (reload_reg_used_in_insn);
   CLEAR_HARD_REG_SET (reload_reg_used_in_other_addr);
 
+#if 0 /* TARGET_M68HC11 or NO_SPILL_REG_ROUND_ROBIN */
+  /* Don't use the round-robin fashion for allocation of spill registers.
+     If we use round-robin, the reload pass allocates Y and Z registers
+     which are expensive compared to X and D.  */
+  last_spill_reg = -1;
+#endif
+  
   CLEAR_HARD_REG_SET (reg_used_in_insn);
   {
     HARD_REG_SET tmp;
@@ -6037,6 +6045,29 @@ deallocate_reload_reg (r)
   reload_spill_index[r] = -1;
 }
 
+
+/* Returns true if merging reloads i and j should result in a
+   RELOAD_FOR_OTHER_ADDRESS reload, else false for RELOAD_OTHER.  */
+static int
+merge_becomes_other_address (int i, int j)
+{
+  int wn1 = rld[i].when_needed;
+  int wn2 = rld[j].when_needed;
+
+  if (wn2 == RELOAD_FOR_OTHER_ADDRESS)
+    wn2 = wn1;
+  else if (wn1 != RELOAD_FOR_OTHER_ADDRESS)
+    return 0;
+
+  return (wn2 == RELOAD_FOR_INPUT_ADDRESS
+	  || wn2 == RELOAD_FOR_INPADDR_ADDRESS
+	  || wn2 == RELOAD_FOR_OUTPUT_ADDRESS
+	  || wn2 == RELOAD_FOR_OUTADDR_ADDRESS
+	  || wn2 == RELOAD_FOR_OPERAND_ADDRESS
+	  || wn2 == RELOAD_FOR_OPADDR_ADDR
+	  || wn2 == RELOAD_FOR_OTHER_ADDRESS);
+}
+
 /* If SMALL_REGISTER_CLASSES is nonzero, we may not have merged two
    reloads of the same item for fear that we might not have enough reload
    registers. However, normally they will get the same reload register
@@ -6050,6 +6081,7 @@ deallocate_reload_reg (r)
    This will not increase the number of spill registers needed and will
    prevent redundant code.  */
 
+extern const char *const reload_when_needed_name[];
 static void
 merge_assigned_reloads (insn)
      rtx insn;
@@ -6114,6 +6146,7 @@ merge_assigned_reloads (insn)
       if (j == n_reloads
 	  && max_input_address_opnum <= min_conflicting_input_opnum)
 	{
+          int changed = 0;
 	  for (j = 0; j < n_reloads; j++)
 	    if (i != j && rld[j].reg_rtx != 0
 		&& rtx_equal_p (rld[i].reg_rtx, rld[j].reg_rtx)
@@ -6121,12 +6154,22 @@ merge_assigned_reloads (insn)
 		    || rld[j].when_needed == RELOAD_FOR_INPUT_ADDRESS
 		    || rld[j].when_needed == RELOAD_FOR_OTHER_ADDRESS))
 	      {
-		rld[i].when_needed = RELOAD_OTHER;
+ 		if (merge_becomes_other_address (i, j))
+ 		  rld[i].when_needed = RELOAD_FOR_OTHER_ADDRESS;
+ 		else
+ 		  rld[i].when_needed = RELOAD_OTHER;
 		rld[j].in = 0;
 		reload_spill_index[j] = -1;
 		transfer_replacements (i, j);
+                changed = 1;
 	      }
 
+ 	  /* If this is now RELOAD_OTHER or RELOAD_FOR_OTHER_ADDRESS,
+ 	     look for any reloads that load parts of this operand and
+ 	     set them to RELOAD_FOR_OTHER_ADDRESS if they were for
+ 	     inputs, RELOAD_OTHER for outputs.  Note that this test is
+ 	     equivalent to looking for reloads for this operand
+  	     number.  */
 	  /* If this is now RELOAD_OTHER, look for any reloads that load
 	     parts of this operand and set them to RELOAD_FOR_OTHER_ADDRESS
 	     if they were for inputs, RELOAD_OTHER for outputs.  Note that
@@ -6137,7 +6180,9 @@ merge_assigned_reloads (insn)
 	     same value or a part of it; we must not change its type if there
 	     is a conflicting input.  */
 
-	  if (rld[i].when_needed == RELOAD_OTHER)
+ 	  if (changed
+              && (rld[i].when_needed == RELOAD_OTHER
+ 	          || rld[i].when_needed == RELOAD_FOR_OTHER_ADDRESS))
 	    for (j = 0; j < n_reloads; j++)
 	      if (rld[j].in != 0
 		  && rld[j].when_needed != RELOAD_OTHER
@@ -6152,7 +6197,8 @@ merge_assigned_reloads (insn)
 
 		  rld[j].when_needed
 		    = ((rld[j].when_needed == RELOAD_FOR_INPUT_ADDRESS
-			|| rld[j].when_needed == RELOAD_FOR_INPADDR_ADDRESS)
+			|| rld[j].when_needed == RELOAD_FOR_INPADDR_ADDRESS
+                        || rld[j].when_needed == RELOAD_FOR_OPADDR_ADDR)
 		       ? RELOAD_FOR_OTHER_ADDRESS : RELOAD_OTHER);
 
 		  /* Check to see if we accidentally converted two reloads
@@ -6164,8 +6210,13 @@ merge_assigned_reloads (insn)
 		      if (rld[k].in != 0 && rld[k].reg_rtx != 0
 			  && rld[k].when_needed == rld[j].when_needed
 			  && rtx_equal_p (rld[k].reg_rtx, rld[j].reg_rtx)
-			  && ! rtx_equal_p (rld[k].in, rld[j].in))
+			  && ! rtx_equal_p (rld[k].in, rld[j].in)) {
+                        printf("Changed reload %d, conflict %d with %d\n",
+                               i, k, j);
+                        
 			abort ();
+                      }
+                  
 		}
 	}
     }
@@ -7306,6 +7357,13 @@ emit_reload_insns (chain)
 					      rld[r].when_needed))
 		  CLEAR_HARD_REG_BIT (reg_reloaded_valid, i + k);
 	    }
+          else
+            {
+              /* When the reload does not reach the end, we must
+                 invalidate the old info.  */
+              for (k = 0; k < nr; k++)
+                CLEAR_HARD_REG_BIT (reg_reloaded_valid, i + k);
+            }
 	}
 
       /* The following if-statement was #if 0'd in 1.34 (or before...).
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/ChangeLog.M68HC11 gcc-3.3.6-m68hc1x/gcc/testsuite/ChangeLog.M68HC11
--- gcc-3.3.6/gcc/testsuite/ChangeLog.M68HC11	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/ChangeLog.M68HC11	Fri Jan 20 22:24:30 2006
@@ -0,0 +1,111 @@
+2006-01-20  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute-scz/pr-15493.c (struct): New test for
+	savannah/15493
+
+2005-11-05  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute-scz/pr-13917.c: New test for savannah/13917.
+	* gcc.c-torture/execute-scz/b-20051105.c: New test.
+
+2005-05-08  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/compile-scz/pr-12572.c: Test case for savannah/12572.
+
+2005-04-03  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute-scz/pr-12297.c: Test case for savannah/12297.
+	* gcc.c-torture/execute-scz/pr-12243.c: New test for savannah/12243.
+	* gcc.c-torture/compile-scz/b-2005-02-14.c: New test.
+
+2005-02-13  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR target/16925
+	* gcc.c-torture/compile-scz/pr-16925.c: New test.
+
+	PR target/14629
+	* gcc.c-torture/compile-scz/pr-14629.cc: New test.
+
+2005-02-12  Stephane Carrez  <stcarrez@nerim.fr>
+
+	PR savannah/11903
+	* gcc.c-torture/compile-scz/pr-11903.c: New test.
+
+2005-01-30  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute-scz/pr-11741.c (strncpy): New test
+	for savannah/11741 
+
+2004-08-29  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute-scz/b-20040816.c: New file for
+	bug savannah/10207.
+
+2003-10-01  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.dg/20020219-1.c: Compile with -mshort to make sure integers
+	are 16-bit (test disabled as it defines a huge array).
+	* gcc.dg/20020426-2.c: Likewise.
+	* gcc.dg/20020430-1.c: Likewise.
+	* gcc.dg/20021018-1.c: Likewise.
+	* gcc.dg/20021029-1.c: Likewise.
+	* gcc.dg/20021023-1.c: -fpic is not supported on m6811/m6812.
+
+2003-09-30  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/compile/simd-5.x: Don't execute for 68HC11 because
+	it fails with 16-bit int.
+
+2003-08-02  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute-scz/execute.exp: New testsuite for 68hc11/hc12.
+	andqi.c, b-20020520.c, bitfield.c, malloc.c, negqi.c,
+	autoinc.c, bigmul.c, bset.c, memset-2003-01-25.c, orqi.c,
+	b-20010414.c, bit.c, mul-1.c, setjmp-test.c: New test for compilation
+	and execution.
+
+	* gcc.c-torture/compile-scz/compile.exp: New testsuite for 68hc11/hc12.
+	add_opt.c, b-20010920.c, b-20030518.c, di.c, orext.c, push.c,
+	string.c, addshift.c, b-20011203.c, b-20030519.c, foo.c, pr-1416.c,
+	ret64.c, tst-asm.c, alloca.c, b-20020203.c, b-2003-07-04.c,
+	fprintf.c, pr-6698.c, rotate.c, vsprintf.c, ashr.c, b-20020206.c,
+	b-2003-07-30.c, gcc-bug.c, pr-6744.c, sex.c, b-20000411.c,
+	b-20020403.c, bclr.c, interrupt.c, pr-7223.c, sext.c,
+	b-20001206.c, b-20020610.c, lshr.c, pr-7361.c,
+	shift-1.c, b-20010424.c, b-20021015.c, cp.c, min.c, printf.c
+	shl.c: New tests for compilation only.
+
+2003-07-20  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute/ieee/920810-1.x: New file, don't execute on
+	68HC11/HC12 because sprintf does not support floats.
+
+2003-07-20  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute/shiftdi.x: New file, don't execute this
+	test on 68HC11/HC12 as it relies on 32-bit ints.
+	* gcc.c-torture/execute/20021024-1.x: New file, likewise.
+
+2003-05-18  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.c-torture/execute/20020404-1.x: New file, don't run this
+	test on 68HC11/68HC12.
+
+2003-05-18  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* gcc.dg/20001009-1.c: -fpic is not supported on m6811-* and m6812-*
+	* gcc.dg/inline-2.c: Likewise.
+	* gcc.dg/20030225-1.c: Likewise.
+	* gcc.dg/20010912-1.c: Likewise.
+	* gcc.dg/20020122-4.c: Likewise.
+	* gcc.dg/20020415-1.c: Likewise.
+	* gcc.dg/20021116-1.c: Likewise.
+	* gcc.dg/20030213-1.c: Likewise.
+	* gcc.dg/20030120-1.c: Likewise.
+	* gcc.misc-tests/bprob.exp: Don't run on m6811-* and m6812-* since
+	the __bb_init_func are not available.
+
+2003-05-18  Stephane Carrez  <stcarrez@nerim.fr>
+
+	* testsuite/gcc.c-torture/compile/20010327-1.x: New file, don't
+	run this test on m6811/m6812 as it assumes pointers are 32-bits.
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/g++.dg/bprob/bprob.exp gcc-3.3.6-m68hc1x/gcc/testsuite/g++.dg/bprob/bprob.exp
--- gcc-3.3.6/gcc/testsuite/g++.dg/bprob/bprob.exp	Mon Oct 21 22:20:58 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/g++.dg/bprob/bprob.exp	Sat Nov  5 19:17:25 2005
@@ -1,4 +1,4 @@
-#   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+#   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,7 +20,9 @@
 # Some targets don't have any implementation of __bb_init_func or are
 # missing other needed machinery.
 if { [istarget mmix-*-*]
-     || [istarget cris-*-*] } {
+     || [istarget cris-*-*]
+     || [istarget m6811-*-*]
+     || [istarget m6812-*-*] } {
     return
 }
 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile/20010327-1.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile/20010327-1.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile/20010327-1.x	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile/20010327-1.x	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,8 @@
+# This test does not compile on m68hc11 because it
+# assumes pointers are 32-bits
+
+if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } {
+      return 1
+}
+
+return 0
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile/920521-1.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile/920521-1.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile/920521-1.x	Thu Jun 29 05:10:00 2000
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile/920521-1.x	Sat Nov  5 19:17:25 2005
@@ -1,2 +1,7 @@
+# Test defines an asm which sometimes requires too many
+# registers for HC11/HC12.
+if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } {
+      return 1
+}
 set options "-S"
 return 0
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile/simd-5.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile/simd-5.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile/simd-5.x	Sat May 24 13:55:35 2003
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile/simd-5.x	Sat Nov  5 19:17:25 2005
@@ -3,6 +3,11 @@ if { [istarget "h8300-*-*"] } {
     return 1;
 }
 
+# On 68HC11 is fails with 16-bit ints
+if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } {
+    return 1;
+}
+
 if { [istarget "sparc64-*-*"] || [istarget "sparcv9-*-*"] } {
     # On SPARC64/SPARC-V9 it fails, except with -m32.
     set torture_eval_before_compile {
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/add_opt.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/add_opt.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/add_opt.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/add_opt.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,17 @@
+unsigned long addsi_and16(unsigned long a, unsigned long b)
+{
+  return a + (b & 0x0ffff);
+}
+
+unsigned long addsi_zext(unsigned long* a, unsigned long* b)
+{
+  *a = *a + (*b & 0x0ffff);
+  return *a;
+}
+
+unsigned long addsi_shift(unsigned long* a, unsigned long* b)
+{
+  *a = *a + (*b << 16);
+  return *a;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/addshift.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/addshift.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/addshift.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/addshift.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,6 @@
+unsigned long addsi_shift(unsigned long* a, unsigned long* b)
+{
+  *a = (*b << 16) + *a;
+  return *a;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/alloca.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/alloca.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/alloca.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/alloca.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,7 @@
+extern __attribute__((noreturn)) void bar(char*, int);
+
+void get(int size, char c)
+{
+  char *buf[size];
+  bar (buf, size);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/ashr.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/ashr.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/ashr.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/ashr.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,5 @@
+long ashr(long a, short b)
+{
+  a = a >> b;
+  return a;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20000411.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20000411.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20000411.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20000411.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,51 @@
+#include <string.h>
+
+typedef unsigned char byte;
+
+// Data structure for queues.
+typedef struct {
+  byte start;
+  byte end;
+  byte count;
+  byte* data;
+  byte length;
+} queueType;
+
+// Add a value to the end of a queue.
+void Enqueue (queueType* queue, void *value, byte size)
+{
+  // Working variables.
+  byte counter;
+  //  byte increment = 1;
+
+  // Save each byte of the given value at start.
+  for (counter = 0; counter < size; counter++) {
+    // Save byte of value.
+    *(queue->data + queue->start) = *(byte*)(value++);
+
+    // Increment start pointer (with wrap around).
+    queue->start = (queue->start + 1) % queue->length;
+
+    // Push the end forward as necessary (with wrap around). 
+    //if (queue->start == queue->end) {
+    //queue->end = (queue->end + 1) % queue->length;
+    //  increment = 0;
+    //}
+  }
+
+  // Increment element count if there was no shifting of the end pointer.
+  //  if (increment) queue->count++;
+}
+
+
+int main()
+{
+  byte input = 0x10;
+
+  static queueType queue;
+  static byte buffer[5];
+  queue.start = queue.end = queue.count = 0;
+  queue.data = buffer;
+  queue.length = 5;
+  Enqueue(&queue,&input,sizeof(input));
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20001206.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20001206.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20001206.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20001206.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1 @@
+char *a[] = {"abcd", "defg"};
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20010424.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20010424.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20010424.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20010424.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,46 @@
+typedef char byte;
+extern int strlen(char*);
+extern void LcdWriteChar(byte,byte,byte,byte);
+extern void os_disable();
+enum align {
+  LCD_ALIGN_LEFT,
+  LCD_ALIGN_CENTER,
+  LCD_ALIGN_RIGHT
+};
+
+void LcdWriteString(
+    byte page_no, byte x, byte y, char *str, byte align
+) {
+
+char *ptr;
+
+ os_disable ();
+    switch( align ) {
+    case LCD_ALIGN_LEFT:
+        break;
+    case LCD_ALIGN_CENTER:
+        x -= strlen( str ) >> 1; break;
+    case LCD_ALIGN_RIGHT:
+        x -= strlen( str ); break;
+    }
+    for( ptr = str; *ptr != 0; ptr++ ) {
+        LcdWriteChar( page_no, x, y, *ptr );
+        x++;
+    }
+}
+
+void
+os_disable()
+{
+  ;
+}
+int main()
+{
+  LcdWriteString(1,2,3,"Hello",LCD_ALIGN_CENTER);
+  return 0;
+}
+void
+LcdWriteChar(byte p, byte x, byte y, byte c)
+{
+  ;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20010920.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20010920.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20010920.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20010920.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,14 @@
+unsigned int segwerte[9];
+void me_Measure_seg();
+void ser_putword( unsigned int data );
+
+void command_messen(void)
+{
+ // volatile int i;
+ int i;
+ me_Measure_seg();
+ for(i=0;i<9;i++)
+  {
+   ser_putword(segwerte[i]);
+  }
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20011203.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20011203.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20011203.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20011203.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,5 @@
+char IsWChanged(char c) {
+  char c1 = c * 10 + 60;
+  return c1;
+}
+ 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20020203.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20020203.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20020203.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20020203.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,4 @@
+unsigned long add_shift(unsigned long a, unsigned long b)
+{
+  return ((a >> 16) + b);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20020206.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20020206.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20020206.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20020206.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,13 @@
+volatile char _io_ports[10];
+char bar;
+
+int get ()
+{
+  while (_io_ports[3] & 0x80)
+    continue;
+
+  if (bar & 0x80)
+    return _io_ports[1];
+  
+  return _io_ports[2];
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20020403.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20020403.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20020403.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20020403.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,6 @@
+void foo(char* addr, char* data)
+{
+    *((volatile char*)0x0) |= 0x1;
+    *addr++ = *data++;
+    *((volatile char*)0x0) |= 0x1;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20020610.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20020610.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20020610.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20020610.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,8 @@
+int check(char *p)
+{
+  *p = 'a';
+  if (*p == 'a')
+    return *p;
+
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20021015.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20021015.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20021015.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20021015.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,22 @@
+int main (void);
+void Call1 (void);
+unsigned char Var1         __attribute__ ((section (".page0")));
+ 
+void _start (void)
+{
+ main();
+}
+ 
+int main (void)
+{
+ if (!Var1)
+ {
+  Call1();
+ }
+ Var1 |= 1;
+return (0);
+}
+ 
+void Call1 (void)
+{
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-2003-07-04.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-2003-07-04.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-2003-07-04.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-2003-07-04.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,12 @@
+typedef unsigned long __u32;
+typedef unsigned short __u16;
+__u16 tcp_chksum;
+void a(void)
+{
+   
+     __u32 checksum;
+     checksum += checksum >> 16;
+     tcp_chksum = ~checksum;
+}
+
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-2003-07-30.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-2003-07-30.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-2003-07-30.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-2003-07-30.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,15 @@
+struct a 
+{
+  int a;
+  int b;
+  char bar[253];
+  long d;
+  int c[3];
+};
+
+struct a table[10];
+
+int get(int p)
+{
+  return table[p].c[2];
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20030518.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20030518.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20030518.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20030518.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,16 @@
+extern volatile unsigned char _io_ports[];
+
+int main(void)
+{
+    unsigned short x;
+    int i = 0;
+
+    x = (_io_ports[0x00] << 8) | _io_ports[0x00];
+
+    if (x >> i)
+    {
+        _io_ports[0x00] = 0;
+    }
+
+    return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20030519.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20030519.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-20030519.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-20030519.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,19 @@
+/*
+ *  compile with:
+ * m6811-elf-gcc -mshort -O -fomit-frame-pointer -S test.c
+ *          
+ * Then notice that the generated code references the frame pointer,
+ * even though we have told the compiler not to use it. The code is
+ * correct if optimization is disabled.
+ * */
+            
+void __attribute__((interrupt)) do_something(char *p1, char *p2);
+            
+void __attribute__((interrupt)) something(char *p1)
+{
+   char p2;
+   char* p2p = &p2;
+   do_something(p1, p2p);
+}
+
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-2005-02-14.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-2005-02-14.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/b-2005-02-14.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/b-2005-02-14.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,16 @@
+unsigned int x;
+int main(void);
+int main()
+{
+   
+      while(1)
+     {
+	
+	      for (x=1; x<=60000;x++); // Delay loop
+	      for (x=1; x<=60000;x++); // Delay loop
+     }
+   
+      return 0;
+}
+
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/bclr.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/bclr.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/bclr.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/bclr.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,13 @@
+#define bclr(m, o, b) \
+    __asm __volatile("bclr %i1,%0 %2" : : "x" (m), "n" (o), "n" (b))
+ 
+extern volatile unsigned char _io_ports[];
+extern unsigned short toto;
+
+void set(char* p)
+{
+  bclr(_io_ports, 0x30, 0x20);
+  _io_ports[0x30] |= 0x20;
+  p[2] |= 1;
+  toto |= 4;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/compile.exp gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/compile.exp
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/compile.exp	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/compile.exp	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,35 @@
+# Expect driver script for GCC Regression Tests
+# Copyright (C) 1993, 1995, 1997 Free Software Foundation
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
+
+# These tests come from Torbjorn Granlund's (tege@cygnus.com)
+# C torture test suite, and other contributors.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+# load support procs
+load_lib c-torture.exp
+
+foreach testcase [glob -nocomplain $srcdir/$subdir/*.c] {
+    # If we're only testing specific files and this isn't one of them, skip it.
+    if ![runtest_file_p $runtests $testcase] then {
+	continue
+    }
+
+    c-torture $testcase
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/cp.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/cp.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/cp.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/cp.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,6 @@
+#include <stddef.h>
+
+void copy(short *s, short *q, size_t l)
+{
+  while (--l > 0) *s++ = *q++;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/di.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/di.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/di.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/di.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,5 @@
+long long shl(long long a)
+{
+  return a << 1;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/foo.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/foo.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/foo.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/foo.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,4 @@
+int __attribute__((section("init")))  main()
+{
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/fprintf.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/fprintf.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/fprintf.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/fprintf.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,28 @@
+/*
+ * Simple replacement of fprintf() for use by GCC testsuite.
+ */
+#include <stdarg.h>
+#include <stddef.h>
+
+typedef struct _file {
+  long a;
+} FILE;
+
+extern int vsprintf(char*, const char*, ...);
+extern int write(int, const char*, size_t);
+
+int
+fprintf(FILE* fp, const char* fmt, ...)
+{
+  char buf[256];
+  va_list args;
+  int i;
+
+  va_start(args, fmt);
+  i=vsprintf(buf,fmt,args);
+  va_end(args);
+
+  write(0, buf, i);
+  return i;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/gcc-bug.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/gcc-bug.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/gcc-bug.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/gcc-bug.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,87 @@
+/*
+command that triggered the bug:
+$ m68hc12-elf-gcc -O3 -c -I./src -I./sys-inc -fno-builtin  src/hc12_eeprom.c -o obj/hc12_eeprom.o
+src/hc12_eeprom.c: In function `write_eeprom':
+src/hc12_eeprom.c:44: Insn does not satisfy its constraints:
+(insn 32 30 128 (set (mem:QI (const_int 243 [0xf3]) 0)
+        (ior:QI (mem:QI (const_int 243 [0xf3]) 0)
+            (const_int 22 [0x16]))) 83 {*iorqi3_const} (insn_list 25 (nil))
+    (nil))
+src/hc12_eeprom.c:44: Internal compiler error in reload_cse_simplify_operands, at reload1.c:8387
+Please submit a full bug report,
+with preprocessed source if appropriate.
+See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
+make: *** [obj/hc12_eeprom.o] Error 1
+*/
+# 7 "src/hc12_eeprom.c"
+# 1 "src/hc912bc32.h" 1
+# 8 "src/hc12_eeprom.c" 2
+# 1 "src/hc12_util.h" 1
+# 12 "src/hc12_util.h"
+enum true_false { false=0, true};
+# 22 "src/hc12_util.h"
+typedef char bool;
+typedef char boolean;
+typedef unsigned char byte;
+typedef unsigned int uint;
+typedef unsigned long ulong;
+
+typedef const unsigned char* pcbyte;
+typedef const unsigned short* pcword;
+# 40 "src/hc12_util.h"
+void wait_1msec(void);
+void wait_10msec(void);
+void sleep(unsigned long);
+char bitNr(char);
+
+void initMain(void);
+void restartMain(void);
+
+void InitLock(char*);
+bool SetLock(char*);
+void ResetLock(char*);
+void WaitLock(char*);
+
+void BootLoaderDownload(void);
+void BootLoad(void);
+void Reboot(void);
+void Coldstart(void);
+char IsInterrupt(void);
+
+boolean isMenu(void);
+# 9 "src/hc12_eeprom.c" 2
+
+
+
+# 1 "src/hc12_eeprom.h" 1
+# 41 "src/hc12_eeprom.h"
+void write_eeprom(unsigned char*,unsigned char);
+# 13 "src/hc12_eeprom.c" 2
+
+
+
+void write_eeprom
+   (unsigned char* pPointer,
+    unsigned char bByte)
+{
+    if (*pPointer!=bByte)
+    {
+
+        (* (unsigned char *) (0x0000 + 0xF1))=0x00;
+        (* (unsigned char *) (0x0000 + 0xF3))|=0x02|0x04|0x10;
+        *pPointer=bByte;
+        (* (unsigned char *) (0x0000 + 0xF3))|=0x01;
+        wait_10msec();
+        (* (unsigned char *) (0x0000 + 0xF3))&=~(0x01);
+
+
+
+        (* (unsigned char *) (0x0000 + 0xF3))&=~(0x04|0x10);
+        *pPointer=bByte;
+        (* (unsigned char *) (0x0000 + 0xF3))|=0x01;
+        wait_10msec();
+        (* (unsigned char *) (0x0000 + 0xF3))&=~(0x01);
+        (* (unsigned char *) (0x0000 + 0xF3))&=~(0x02);
+        (* (unsigned char *) (0x0000 + 0xF1))=0xFF;
+    }
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/interrupt.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/interrupt.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/interrupt.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/interrupt.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,19 @@
+extern char clock_flags;
+extern char time_secs;
+extern char min_flag;
+
+#define REG_BASE 0
+#define REGISTER char
+#define PORTA           (*(volatile REGISTER *)(REG_BASE + 0x00))
+#define SHUTDOWN  0x40
+#define TIMING  0x01
+void __attribute__((interrupt))
+clock_interrupt_handler()
+{
+        PORTA &= ~SHUTDOWN;     /* power everything up*/
+        clock_flags |= TIMING;
+        if(time_secs != 0)
+                return;
+        min_flag = 1;           /* 1 minute flag for main.c*/
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/lshr.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/lshr.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/lshr.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/lshr.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,8 @@
+unsigned long global;
+
+unsigned long ashr(unsigned long a, short b)
+{
+  a = a >> b;
+  global = a >> 1;
+  return a;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/min.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/min.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/min.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/min.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,39 @@
+unsigned short uminhi(unsigned short a, unsigned short b)
+{
+  a = (a < b) ? a : b;
+  return a;
+}
+
+unsigned short umaxhi(unsigned short a, unsigned short b)
+{
+  a = (a > b) ? a : b;
+  return a;
+}
+
+unsigned char e;
+
+void
+umaxqi(unsigned char a)
+{
+  e = (a > e) ? e : a;
+}
+
+unsigned char
+umaxqi2(unsigned char a)
+{
+  a = (a > e) ? e : a;
+  return a;
+}
+
+void
+uminqi(unsigned char a)
+{
+  e = (a < e) ? e : a;
+}
+
+unsigned char
+uminqi2(unsigned char a)
+{
+  a = (a < e) ? e : a;
+  return a;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/orext.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/orext.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/orext.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/orext.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,16 @@
+unsigned long b;
+unsigned char c;
+unsigned char d;
+
+unsigned short get()
+{
+  return (c << 8) | d;
+}
+
+unsigned long orext(unsigned long a)
+{
+  a = (b >> 16) | a;
+  a = a | c;
+  a = a | (unsigned long) ((d | (c << 8)));
+  return a;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-11813.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-11813.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-11813.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-11813.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,20 @@
+struct Regs
+{
+volatile unsigned char reg;
+};
+
+struct Device
+{
+struct Regs *regs;
+};
+
+struct Device dev0 =
+{
+(struct Regs *) 0x0100,
+};
+
+void init(struct Device *device)
+{
+device->regs->reg |= 0x01;
+device->regs->reg &= ~0x01;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-12572.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-12572.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-12572.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-12572.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,14 @@
+int main()
+{
+   
+   unsigned short x;
+   
+   for (x=1; x<=0x8000; x++) 
+     {
+	
+	asm volatile ("nop");
+     }
+   
+   
+   return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-1416.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-1416.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-1416.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-1416.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,8 @@
+
+#define MIN(x1,x2) (x1 > x2)?x1:x2
+typedef unsigned short WORD;
+
+WORD wT;
+WORD TstMin(void) {
+  return MIN(wT, 99);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-14629.cc gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-14629.cc
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-14629.cc	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-14629.cc	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,47 @@
+extern void Hex2Ascii(unsigned char,unsigned char*);
+extern void cputch(char);
+class CFrame {
+ protected:
+  unsigned char *m_rxBuf;
+  unsigned int m_frameLen;
+  unsigned char OnRxChar(unsigned char __c);
+ private:
+  unsigned int m_rxCnt;
+  unsigned char m_state;
+};
+
+unsigned char
+CFrame::OnRxChar(unsigned char c)
+{
+  switch (m_state)
+    {
+    case 0:
+      m_rxCnt = 0;
+      m_state = 1;
+      
+    case 1:
+      if (c == 0x5a)
+        {
+          ++m_rxCnt;
+          if (m_rxCnt == 2)
+            m_state = 2;
+        }
+      else
+        {
+          char buf[2];
+          Hex2Ascii(c, (unsigned char*)buf);
+          cputch(buf[0]);
+          cputch(buf[1]);
+          m_rxCnt = 0;
+        }
+      break;
+      
+    case 2:
+      m_rxBuf[m_rxCnt++] = c;
+      if (m_rxCnt == (unsigned int) 7)
+        m_frameLen = *(unsigned short*)(&m_rxBuf[4]);
+      break;
+    }
+  
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-16925.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-16925.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-16925.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-16925.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,9 @@
+/* PR target/16925: ICE on 64-bit host architectures */
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
+
+void ICE_on_64bit_archs (void)
+{
+  UDItype a;
+  a |= 0x8000000000000LL;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-17551.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-17551.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-17551.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-17551.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,14 @@
+int calc (void)
+  {
+    int  mask_size;
+    int i,j,x;
+
+  for(i=-mask_size; i<=mask_size; i++)
+    for(j=-mask_size; j<=mask_size; j++)
+    {
+      x = (i*i)+(j*j);
+    }
+
+  return x; 
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-6698.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-6698.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-6698.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-6698.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,57 @@
+/*  scanner.c */
+/*  J. Tritthardt, MPIMF/BMO */
+/*  Version 1.0 - 28.02.2002 */
+
+/*  Testprogramm fuer die LEDs der Scanner-Box */
+
+#define COPCTL *(volatile unsigned char *)(0x16)
+
+#define IO_BASE 0
+#define PORTT *((volatile unsigned char *)(IO_BASE + 0xAE))
+#define DDRT *((volatile unsigned char *)(IO_BASE + 0xAF))
+
+#define led_red 0x02
+#define led_red_port PORTT
+#define led_red_ddr DDRT
+#define led_green 0x08
+#define led_green_port PORTT
+#define led_green_ddr DDRT
+
+void delay();
+
+int main() 
+{ 
+  led_red_port = led_red_port | led_red;
+  led_red_ddr = led_red_ddr | led_red;
+  led_green_port = led_green_port | led_green;
+  led_green_ddr = led_green_ddr | led_green;
+
+  while (1) {
+    led_red_port = led_red_port | led_red;
+    led_green_port = led_green_port & ~led_green;
+
+    delay();
+
+    led_green_port = led_green_port | led_green;
+    led_red_port = led_red_port & ~led_red;
+
+    delay();
+  }
+
+  return 0;
+} 
+ 
+void __premain() 
+{
+    __asm__ __volatile__ ("clr 0x16");
+} 
+
+void delay()
+{
+#ifdef mc6812
+  __asm__ __volatile__ ("PSHD\n\tLDD	0xFFFF\n\tDBNE	D,-3\n\tPULD\n\tRTS");
+#endif
+#ifdef mc6811
+  __asm__ __volatile__ ("PSHA\n\tLDD	0xFFFF\n\tPULA\n\tRTS");
+#endif
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-6744.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-6744.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-6744.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-6744.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,1671 @@
+# 1 "eeprom.c"
+#define ASM 0 
+
+
+
+
+
+
+
+# 1 "eeprom.h" 1
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "/usr/lib/gcc-lib/m6811-elf/2.95.3/include/stdbool.h" 1 3
+ 
+
+
+
+ 
+
+typedef enum
+  {
+    false = 0,
+    true = 1
+  } bool;
+
+ 
+
+
+
+ 
+
+
+
+# 16 "eeprom.h" 2
+
+# 1 "../../include/sys/hwreg.h" 1
+ 
+
+
+
+
+
+
+
+
+# 1 "../../include/asm-m68hc12/hwreg.h" 1
+ 
+
+
+
+
+
+
+
+
+
+
+
+# 1 "../../include/asm-m68hc12/param.h" 1
+ 
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 13 "../../include/asm-m68hc12/hwreg.h" 2
+
+# 1 "../../include/asm-m68hc12/hwregaddr.h" 1
+ 
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+ 
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+  
+  
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+  
+
+
+
+
+                                    
+
+
+ 
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+ 
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+              
+
+
+ 
+
+
+
+
+
+
+
+              
+
+              
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+              
+
+ 
+
+
+ 
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+
+ 
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+ 
+
+
+ 
+
+ 
+
+
+
+
+
+
+
+
+
+ 
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 14 "../../include/asm-m68hc12/hwreg.h" 2
+
+
+typedef unsigned char byte;
+typedef unsigned short word;
+
+ 
+extern volatile byte _io_ports[];
+extern volatile byte *io_ports;
+
+
+
+
+
+
+ 
+
+
+
+ 
+
+
+
+
+
+ 
+
+
+ 
+
+
+static inline void
+relocate_reg(word base)
+{
+  _io_ports[0x11 ] = (base/0x100) & 0xF8;
+  io_ports = (byte*) base;
+}
+
+ 
+
+
+static inline void
+set_bus_expanded(void)
+{
+  *((volatile word*) &_io_ports[( 0x0A  )])  = (word)((byte)(1<<7) | (1<<2) )*0x100 + ((1<<5) | (1<<4) ) ;
+  _io_ports[( 0x13  )]  = 0x7F;        
+}
+
+
+ 
+
+
+static inline void
+set_bus_expanded_wide(void)
+{
+  *((volatile word*) &_io_ports[( 0x0A  )])  = (word)((byte)(1<<7) | (1<<2) )*0x100 + ((1<<6) | (1<<5) | (1<<4) ) ;
+  _io_ports[( 0x13  )]  = 0x7F;
+}
+
+ 
+static inline void
+set_bus_single_chip(void)
+{
+  _io_ports[( 0x0B  )]  = (byte)(1<<7) | (1<<4) ;
+}
+
+ 
+
+
+static inline void
+rti_init(byte scale)
+{
+  _io_ports[( 0x14  )]  = (1<<5)  | (scale & (0x7) );
+}
+
+ 
+static inline byte
+rti_getFlg(void)
+{
+  return _io_ports[( 0x15  )] ;
+}
+
+ 
+static inline void
+rti_clearFlg(void)
+{
+  _io_ports[( 0x15  )]  = 0x80 ;
+}
+
+ 
+static inline void
+cop_disable(void)
+{
+#if ASM
+  asm("bclr %0,%1" : : "R"( _io_ports[( 0x16  )]  ), "i"(  (0x7)  )) ;        
+#endif
+}
+
+ 
+static inline void
+cop_force_reset(void)
+{
+  _io_ports[( 0x17  )]  = 0x55;
+  _io_ports[( 0x17  )]  = 0xAA;
+}
+
+ 
+
+static inline void
+cop_reset(void)
+{
+
+  cop_force_reset();
+
+}
+
+ 
+static inline void
+cop_init(void)
+{
+  cop_force_reset();
+  _io_ports[( 0x16  )]  = (1<<3)  | 2 ;
+}
+
+
+
+
+
+
+# 10 "../../include/sys/hwreg.h" 2
+
+
+
+
+
+
+
+# 17 "eeprom.h" 2
+
+
+# 1 "/usr/lib/gcc-lib/m6811-elf/2.95.3/include/stddef.h" 1 3
+
+
+
+
+
+
+ 
+
+
+# 19 "/usr/lib/gcc-lib/m6811-elf/2.95.3/include/stddef.h" 3
+
+
+
+ 
+
+
+ 
+
+
+
+
+
+ 
+
+
+# 61 "/usr/lib/gcc-lib/m6811-elf/2.95.3/include/stddef.h" 3
+
+
+ 
+
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+
+ 
+
+ 
+
+# 131 "/usr/lib/gcc-lib/m6811-elf/2.95.3/include/stddef.h" 3
+
+
+ 
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+typedef short unsigned int size_t;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+
+
+
+ 
+
+# 271 "/usr/lib/gcc-lib/m6811-elf/2.95.3/include/stddef.h" 3
+
+
+# 283 "/usr/lib/gcc-lib/m6811-elf/2.95.3/include/stddef.h" 3
+
+
+ 
+
+ 
+
+# 317 "/usr/lib/gcc-lib/m6811-elf/2.95.3/include/stddef.h" 3
+
+
+
+
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 19 "eeprom.h" 2
+
+
+
+
+ 
+bool eeprom_isWriting (void);
+
+ 
+
+int eeprom_prepareRead (word offset);
+
+ 
+
+
+int eeprom_readByte (word offset);
+
+ 
+
+
+word eeprom_readWord (word offset);
+
+ 
+void eeprom_chkWrite (void);
+
+ 
+
+int eeprom_writeByte (word offset, byte data);
+
+ 
+
+
+int eeprom_writeWord (word offset, word data);
+
+
+
+
+
+
+# 9 "eeprom.c" 2
+
+# 1 "../../include/timer.h" 1
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+# 1 "../../include/sys/timer.h" 1
+ 
+
+
+
+
+
+
+
+
+
+# 1 "../../include/asm-m68hc12/timer.h" 1
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+   
+
+  static inline void
+  timer_init(void)
+  {
+    _io_ports[( 0x8D  )]  = (byte)(1<<5)  | 3 ;
+     
+    _io_ports[( 0x86  )]   = (byte)(1<<7)  | (byte)(1<<5)  | (byte)(1<<4) ;
+  }
+
+   
+
+  static inline short
+  get_hwtime(void)
+  {
+    return *((volatile word*) &_io_ports[( 0x84  )]) ;
+  }
+
+   
+
+  static inline byte
+  get_tof_flg(void)
+  {
+    return (_io_ports[( 0x8F  )]  & (byte)(1<<7) );
+  }
+
+   
+  static inline void
+  tc_set_outputcompare(byte n)
+  {
+    _io_ports[( 0x80  )]  |= 1<<n;
+  }
+
+   
+  static inline void
+  tc_set_inputcapture(byte n)
+  {
+    _io_ports[( 0x80  )]  &= (byte)~(1<<n);
+  }
+
+   
+  static inline void
+  tc_interrupt_enable(byte n)
+  {
+    _io_ports[( 0x8C  )]  |= (byte)(1<<n);
+  }
+
+   
+  static inline void
+  tc_interrupt_disable(byte n)
+  {
+    _io_ports[( 0x8C  )]  &= (byte)~(1<<n);
+  }
+
+   
+
+  static inline byte
+  tc_get_flg(byte n)
+  {
+    return (_io_ports[( 0x8E  )]  & (byte)(1<<n));
+  }
+
+   
+
+  static inline word
+  tc_get_value(byte n)
+  {
+    return ((volatile word*) &_io_ports[( 0x90  )]) [n];
+  }
+
+   
+
+  static inline void
+  tc_set_value(byte n, word val)
+  {
+    ((volatile word*) &_io_ports[( 0x90  )]) [n] = val;
+  }
+
+   
+
+
+  static inline void
+  tc_add_microseconds(byte n, unsigned long t)
+  {
+    tc_set_value(n, tc_get_value(n) + (word)((8000000   / (1<< 3 ))   * t/1000000));
+  }
+
+   
+
+
+  static inline void
+  tc_set_tocmode(byte n, byte mode)
+  {
+    word d = *((volatile word*) &_io_ports[( 0x88  )]) ;
+    n *= 2;                        
+    d &= ~(0x3 << n);              
+    d |= mode << n;                
+
+    *((volatile word*) &_io_ports[( 0x88  )])  = d;
+  }
+
+   
+
+
+  static inline void
+  tc_toggle_tocmode(byte n)
+  {
+    *((volatile word*) &_io_ports[( 0x88  )])  ^= (word)(1<<(n*2));
+  }
+
+   
+
+
+  static inline void
+  tc_set_ticmode(byte n, byte mode)
+  {
+    word d = *((volatile word*) &_io_ports[( 0x8A  )]) ;
+    n *= 2;                         
+    d &= ~(0x3 << n);
+    d |= mode << n;
+
+    *((volatile word*) &_io_ports[( 0x8A  )])  = d;
+  }
+
+
+
+
+
+
+# 11 "../../include/sys/timer.h" 2
+
+
+
+
+
+
+# 14 "../../include/timer.h" 2
+
+# 1 "../../include/sys/locks.h" 1
+ 
+
+
+
+
+
+
+
+
+
+# 1 "../../include/asm-m68hc12/locks.h" 1
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 
+
+ 
+
+static inline short
+lock(void)
+{
+  short ccsav;
+  asm volatile ("tpa\nsei": "=d"(ccsav):: "cc");
+  return ccsav;
+}
+
+ 
+
+static inline void
+unlock(void)
+{
+  asm volatile ("cli"::: "cc");
+}
+
+ 
+
+static inline void
+restorelock(short ccsav)
+{
+  asm volatile ("tap":: "d"(ccsav): "cc");
+}
+
+
+
+
+
+
+# 11 "../../include/sys/locks.h" 2
+
+
+
+
+
+
+# 15 "../../include/timer.h" 2
+
+
+   
+
+
+
+
+
+
+   
+
+
+
+
+
+
+  extern volatile unsigned TofCnt;          
+  extern volatile unsigned MillisecCnt;
+  extern volatile byte TimerFlgs;
+
+   
+
+  extern void timer_init_tof (void);
+
+   
+
+  extern signed char reserveTimerNum (byte n);
+
+   
+
+  extern signed char reserveTimerNumOnly (byte n);
+  extern void freeTimerNum (byte n);
+  extern void timer_init_msec (byte tnum);
+  extern void doTimeMsec (void);
+  extern unsigned long get_time (void);
+
+  extern void intTof (void) __attribute__((__interrupt__));
+  extern void intTimeMsec (void) __attribute__((__interrupt__));
+
+   
+
+  static inline void
+  doTof (void)
+  {
+    get_hwtime();   
+    TofCnt++;
+#if ASM
+    asm("bset %0,%1"::"a"( TimerFlgs ), "i"(  (byte)(1<<7)  )) ;
+#endif
+  }
+
+   
+  static inline byte
+  isTickMsecFlg (void)
+  {
+    return TimerFlgs & (1<<6) ;
+  }
+
+   
+  static inline void
+  clearTickMsecFlg (void)
+  {
+#if ASM
+    asm("bclr %0,%1"::"R"( TimerFlgs ), "i"(  (1<<6)  )) ;
+#endif
+  }
+
+
+
+
+
+
+# 10 "eeprom.c" 2
+
+
+
+
+extern volatile byte _eeprom_base[0x300 ];
+static word   dataOffset;           
+static byte   dataBuf[2];           
+static byte   dataSize;             
+static byte   writeTries = 2 ;     
+static signed char eepTimerNum = -1;
+
+
+
+
+
+ 
+
+bool
+eeprom_isWriteMode (void)
+{
+  return _io_ports[( 0xF3  )]  & (1<<1) ;
+}
+
+ 
+
+static inline void
+eeprom_mapOn (void)
+{
+#if ASM
+  asm("bset %0,%1"::"R"( _io_ports[( 0x12  )]  ), "i"(  (1<<0)  )) ;
+#endif
+}
+
+ 
+static inline void
+eeprom_mapOff (void)
+{
+#if ASM
+  asm("bclr %0,%1"::"R"( _io_ports[( 0x12  )]  ), "i"(  (1<<0)  )) ;
+#endif
+}
+
+ 
+
+int
+eeprom_prepareRead (word offset)
+{
+  if(offset >= 0x300 )    return -2;    
+  if(eeprom_isWriteMode())   return -1;    
+  eeprom_mapOn();                        
+  return 0;
+}
+
+ 
+
+
+int
+eeprom_readByte (word offset)
+{
+  int rtn;
+
+  rtn = eeprom_prepareRead(offset);
+  if(rtn < 0) return rtn;
+
+  return _eeprom_base[( offset )] ;         
+}
+
+ 
+
+
+word
+eeprom_readWord (word offset)
+{
+  if(eeprom_prepareRead(offset) < 0) return 0xFFFF;
+  return *((volatile word*) &_eeprom_base[( offset )]) ;         
+}
+
+ 
+void
+eeprom_chkWrite (void)
+{
+  if(eepTimerNum < 0) return;        
+
+   
+  if((_io_ports[( 0xF3  )]  & (1<<0) ) )
+  {
+     
+    if(tc_get_flg(eepTimerNum))
+    {
+       
+#if ASM
+      asm("bclr %0,%1" : : "R"(_io_ports[( 0xF3  )]  ), "i"(  (1<<0)  )) ;
+      asm("bclr %0,%1" : : "R"( _io_ports[( 0xF3  )]  ), "i"(  (1<<1)  )) ;    
+#endif
+    }
+  }
+
+   
+  if(! (_io_ports[( 0xF3  )]  & (1<<0) ) )
+  {
+     
+    if(dataSize)
+    {
+      byte dataOddBoundary = dataSize & 1;      
+      byte dataIdx;
+      word currOffset, r, w;
+
+       
+      dataIdx = dataSize - 1;
+#if ASM
+      asm("bclr %0,%1"::"R"( dataIdx ), "i"(  1 )) ;                    
+#endif
+      currOffset = dataOffset + dataIdx;
+
+      if(dataOddBoundary) {
+         
+        r = eeprom_readByte(currOffset);
+        w = dataBuf[dataIdx];
+      }
+      else {
+         
+        r = eeprom_readWord(currOffset);
+        w = *((word*)&dataBuf[dataIdx]);
+      }
+
+       
+      if((w ^ r) & w)
+      {
+         
+#if ASM
+        asm("bset %0,%1"::"R"( _io_ports[( 0xF3  )]  ), "i"(  (1<<4) | (1<<2) | (1<<1)  )) ;
+#endif
+        if(dataOddBoundary)
+        {
+          _eeprom_base[( currOffset )]  = w;      
+        }
+        else
+        {
+          *((volatile word*) &_eeprom_base[( currOffset )])  = w;      
+        }
+
+         
+        tc_set_value(eepTimerNum, get_hwtime()+(word)((8000000   / (1<< 3 ))  *.010));
+#if ASM
+        asm("bset %0,%1"::"R"( _io_ports[( 0xF3  )]  ), "i"(  (1<<0)  )) ;       
+#endif
+      }
+      else if(r != w && writeTries)    
+      {
+         
+        _io_ports[( 0xF3  )]  = (_io_ports[( 0xF3  )]  & ~(1<<2) ) | (1<<1) ;
+
+        if(dataOddBoundary) {
+          _eeprom_base[( currOffset )]  = w;      
+        }
+        else {
+          *((volatile word*) &_eeprom_base[( currOffset )])  = w;      
+        }
+
+        writeTries--;                        
+
+         
+        tc_set_value(eepTimerNum, get_hwtime()+(word)((8000000   / (1<< 3 ))  *.010));
+#if ASM
+        asm("bset %0,%1"::"R"( _io_ports[( 0xF3  )]  ), "i"(  (1<<0)  )) ;       
+#endif
+      }
+      else    
+      {
+        dataSize = dataIdx;                 
+        writeTries = 2 ;        
+
+        if(!dataSize)
+        {
+           
+          freeTimerNum(eepTimerNum);
+          eepTimerNum = -1;
+        }
+      }
+    }
+  }
+}
+
+ 
+
+
+
+
+static int
+eeprom_writeData (word offset, void *data, size_t sz)
+{
+  if(dataSize) return -1;                       
+  if(offset + sz > 0x300 ) return -2;       
+  eepTimerNum = reserveTimerNum(0);              
+  if(eepTimerNum < 0) return -3;                    
+  if(sz > sizeof(dataBuf)) return -4;                  
+
+   
+  tc_set_outputcompare(eepTimerNum);
+
+   
+  dataOffset = offset;
+  memcpy(dataBuf, data, sz);
+  dataSize   = sz;
+
+  return 0;
+}
+
+ 
+
+int
+eeprom_writeByte (word offset, byte data)
+{
+  return eeprom_writeData(offset, &data, 1);
+}
+
+ 
+
+
+int
+eeprom_writeWord (word offset, word data)
+{
+  return eeprom_writeData(offset, &data, 2);
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-7223.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-7223.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-7223.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-7223.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,22 @@
+
+extern int foo(int);
+
+int main(int argn, char ** argv)
+{
+        char i;
+        int pos;
+        short d, e, f;
+
+        for(i=100;i>0;--i){
+                argn += i;
+        }
+
+        e = (short)i-argn;
+        d = argn / 1000;
+
+        pos = foo(d * e);
+
+        (*(((unsigned char *)0x1000)+(0x00))) |= 0x10;
+
+        return argn;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-7361.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-7361.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/pr-7361.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/pr-7361.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,211 @@
+# 5 "essai.c"
+# 1 "nanoK.h" 1
+# 26 "nanoK.h"
+# 1 "type_def.h" 1
+# 26 "type_def.h"
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+typedef signed char s8;
+typedef signed short s16;
+typedef signed int s32;
+# 27 "nanoK.h" 2
+# 45 "nanoK.h"
+u8 nanoK_init(void);
+# 56 "nanoK.h"
+u8 nanoK_task_init(u8 t, void (*fct)(void), u8* stk, u16 stk_len);
+# 65 "nanoK.h"
+u8 nanoK_aggregate_task(u8 t1, u8 t2);
+# 74 "nanoK.h"
+inline void nanoK_task_terminate(void);
+# 84 "nanoK.h"
+inline u8 nanoK_task_reset(u8 t);
+# 98 "nanoK.h"
+void nanoK_hook_init(void (*fct)(void), u8* stk, u16 stk_len);
+
+
+
+
+
+void nanoK_start(void);
+
+
+
+
+
+void nanoK_kernel(void);
+
+
+
+
+typedef struct {
+        struct {
+                u8 CCR;
+                u16 D;
+                u16 X;
+                u16 Y;
+                u16 PC;
+                u16 SP;
+        } hard_regs;
+        struct {
+                u16 r[8];
+                u16 tmp;
+                u16 z;
+                u16 xy;
+                u16 frame;
+        } soft_regs;
+} t_context;
+# 6 "essai.c" 2
+# 1 "vectors.h" 1
+# 26 "vectors.h"
+# 1 "type_def.h" 1
+# 27 "vectors.h" 2
+
+typedef enum {
+        Sci,
+        Spi,
+        Pulse_acc_input,
+        Pulse_acc_overf,
+        Timer_overf,
+        Output_compare_5,
+        Output_compare_4,
+        Output_compare_3,
+        Output_compare_2,
+        Output_compare_1,
+        Input_capture_3,
+        Input_capture_2,
+        Input_capture_1,
+        Real_time,
+        Irq,
+        Xirq,
+        Swi,
+        Illegal,
+        Cop_fail,
+        Cop_clock_fail
+
+} t_vector_num;
+
+extern u8 VECTORS_init(void);
+extern void VECTORS_set(t_vector_num n, void (*f)(void));
+# 7 "essai.c" 2
+# 23 "essai.c"
+extern u8 run_task_num;
+# 37 "essai.c"
+static u16 compteur;
+
+static u8 stk0[50];
+static void task0(void)
+{
+
+        while(1) {
+                (*((u8*)0x1003)) &= ~0x03;
+                (*((u8*)0x1003)) |= 0x00;
+                nanoK_task_terminate();
+        }
+}
+
+static u8 stk1[50];
+static void task1(void)
+{
+
+        while(1) {
+                (*((u8*)0x1003)) &= ~0x02;
+                (*((u8*)0x1003)) |= 0x01;
+                nanoK_task_terminate();
+        }
+}
+
+static u8 stk2[50];
+static void task2(void)
+{
+
+        while(1) {
+                (*((u8*)0x1003)) &= ~0x01;
+                (*((u8*)0x1003)) |= 0x02;
+                nanoK_task_terminate();
+        }
+}
+
+static u8 stk3[50];
+static void task3(void)
+{
+
+        while(1) {
+                (*((u8*)0x1003)) &= ~0x00;
+                (*((u8*)0x1003)) |= 0x03;
+                nanoK_task_terminate();
+        }
+}
+
+static u8 hook_stk[50];
+
+static void hook(void)
+{
+
+        compteur++;
+
+
+
+
+
+
+
+        (*((u8*)0x1025)) |= 0x40;
+
+}
+
+typedef void(*JMP)(void);
+typedef struct t_vectors_table {
+  u8 opcode;
+  JMP f;
+} t_vectors_table;
+
+int main(void)
+{
+
+        (*((u8*)0x1007)) = 0xf3;
+
+        nanoK_init();
+        VECTORS_init();
+        compteur = 0;
+
+
+        nanoK_task_init(0, task0, stk0, sizeof(stk0));
+
+
+        nanoK_task_init(1, task1, stk1, sizeof(stk1));
+
+
+        nanoK_task_init(2, task2, stk2, sizeof(stk2));
+
+
+        nanoK_task_init(3, task3, stk3, sizeof(stk3));
+
+
+        nanoK_hook_init(hook, hook_stk, sizeof(hook_stk));
+
+
+
+
+
+
+
+        VECTORS_set(Real_time, nanoK_kernel);
+        (*((u8*)0x1026)) |= 0x03;
+        (*((u8*)0x1024)) |= 0x43;
+
+
+
+        nanoK_start();
+
+
+        return 0;
+}
+
+
+
+
+void __premain() {
+  return;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/printf.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/printf.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/printf.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/printf.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,24 @@
+/*
+ * Simple replacement of printf() for use by GCC testsuite.
+ */
+#include <stdarg.h>
+#include <stddef.h>
+
+extern int vsprintf(char*, const char*, ...);
+extern int write(int, const char*, size_t);
+
+int
+printf(const char *fmt, ...)
+{
+  char buf[256];
+  va_list args;
+  int i;
+
+  va_start(args, fmt);
+  i=vsprintf(buf,fmt,args);
+  va_end(args);
+
+  write(0, buf, i);
+  return i;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/push.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/push.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/push.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/push.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,4 @@
+int bar()
+{
+  return toto(1, 2, 3, 4);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/ret64.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/ret64.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/ret64.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/ret64.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,9 @@
+long long ret64L()
+{
+  return (long long) (1);
+}
+
+long long ret642L(int a, int b)
+{
+  return (long long) (a + b);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/rotate.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/rotate.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/rotate.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/rotate.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,60 @@
+unsigned short rotate15(unsigned short a)
+{
+  return (a << 15) | (a >> 1);
+}
+unsigned short rotate14(unsigned short a)
+{
+  return (a << 14) | (a >> 2);
+}
+unsigned short rotate13(unsigned short a)
+{
+  return (a << 13) | (a >> 3);
+}
+unsigned short rotate12(unsigned short a)
+{
+  return (a << 12) | (a >> 4);
+}
+unsigned short rotate11(unsigned short a)
+{
+  return (a << 11) | (a >> 5);
+}
+unsigned short rotate10(unsigned short a)
+{
+  return (a << 10) | (a >> 6);
+}
+unsigned short rotate9(unsigned short a)
+{
+  return (a << 9) | (a >> 7);
+}
+unsigned short rotate8(unsigned short a)
+{
+  return (a << 8) | (a >> 8);
+}
+unsigned short rotate7(unsigned short a)
+{
+  return (a << 7) | (a >> 9);
+}
+unsigned short rotate6(unsigned short a)
+{
+  return (a << 6) | (a >> 10);
+}
+unsigned short rotate5(unsigned short a)
+{
+  return (a << 5) | (a >> 11);
+}
+unsigned short rotate4(unsigned short a)
+{
+  return (a << 4) | (a >> 12);
+}
+unsigned short rotate3(unsigned short a)
+{
+  return (a << 3) | (a >> 13);
+}
+unsigned short rotate2(unsigned short a)
+{
+  return (a << 2) | (a >> 14);
+}
+unsigned short rotate1(unsigned short a)
+{
+  return (a << 1) | (a >> 15);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/sex.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/sex.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/sex.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/sex.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,5 @@
+short
+sexh (signed char *p)
+{
+  return *p;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/sext.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/sext.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/sext.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/sext.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,9 @@
+short get16(signed char a)
+{
+  return a;
+}
+
+long get(short a)
+{
+  return a;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/shift-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/shift-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/shift-1.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/shift-1.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,9 @@
+unsigned char Shift( unsigned char bitPosition )
+{
+        unsigned char mask;
+
+        mask = 1 <<  bitPosition;
+
+        return ( mask );
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/shl.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/shl.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/shl.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/shl.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,6 @@
+unsigned long shl(unsigned long a, int b)
+{
+  a = a >> b;
+  bar(b);
+  return a;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/string.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/string.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/string.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/string.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,313 @@
+/*
+ *  linux/lib/string.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+/*
+ * stupid library routines.. The optimized versions should generally be found
+ * as inline code in <asm-xx/string.h>
+ *
+ * These are buggy as well..
+ */
+ 
+#define NULL (void*)0
+typedef unsigned short size_t;
+
+char * ___strtok = NULL;
+
+#ifndef __HAVE_ARCH_STRCPY
+char * strcpy(char * dest,const char *src)
+{
+	char *tmp = dest;
+
+	while ((*dest++ = *src++) != '\0')
+		/* nothing */;
+	return tmp;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRNCPY
+char * strncpy(char * dest,const char *src,size_t count)
+{
+	char *tmp = dest;
+
+	while (count-- && (*dest++ = *src++) != '\0')
+		/* nothing */;
+
+	return tmp;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRCAT
+char * strcat(char * dest, const char * src)
+{
+	char *tmp = dest;
+
+	while (*dest)
+		dest++;
+	while ((*dest++ = *src++) != '\0')
+		;
+
+	return tmp;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRNCAT
+char * strncat(char *dest, const char *src, size_t count)
+{
+	char *tmp = dest;
+
+	if (count) {
+		while (*dest)
+			dest++;
+		while ((*dest++ = *src++)) {
+			if (--count == 0) {
+				*dest = '\0';
+				break;
+			}
+		}
+	}
+
+	return tmp;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRCMP
+int strcmp(const char * cs,const char * ct)
+{
+	register signed char __res;
+
+	while (1) {
+		if ((__res = *cs - *ct++) != 0 || !*cs++)
+			break;
+	}
+
+	return __res;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRNCMP
+int strncmp(const char * cs,const char * ct,size_t count)
+{
+	register signed char __res = 0;
+
+	while (count) {
+		if ((__res = *cs - *ct++) != 0 || !*cs++)
+			break;
+		count--;
+	}
+
+	return __res;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRCHR
+char * strchr(const char * s, int c)
+{
+	for(; *s != (char) c; ++s)
+		if (*s == '\0')
+			return NULL;
+	return (char *) s;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRRCHR
+char * strrchr(const char * s, int c)
+{
+       const char *p = s + strlen(s);
+       do {
+           if (*p == (char)c)
+               return (char *)p;
+       } while (--p >= s);
+       return NULL;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRLEN
+size_t strlen(const char * s)
+{
+	const char *sc;
+
+	for (sc = s; *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRNLEN
+size_t strnlen(const char * s, size_t count)
+{
+	const char *sc;
+
+	for (sc = s; count-- && *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRSPN
+size_t strspn(const char *s, const char *accept)
+{
+	const char *p;
+	const char *a;
+	size_t count = 0;
+
+	for (p = s; *p != '\0'; ++p) {
+		for (a = accept; *a != '\0'; ++a) {
+			if (*p == *a)
+				break;
+		}
+		if (*a == '\0')
+			return count;
+		++count;
+	}
+
+	return count;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRPBRK
+char * strpbrk(const char * cs,const char * ct)
+{
+	const char *sc1,*sc2;
+
+	for( sc1 = cs; *sc1 != '\0'; ++sc1) {
+		for( sc2 = ct; *sc2 != '\0'; ++sc2) {
+			if (*sc1 == *sc2)
+				return (char *) sc1;
+		}
+	}
+	return NULL;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRTOK
+char * strtok(char * s,const char * ct)
+{
+	char *sbegin, *send;
+
+	sbegin  = s ? s : ___strtok;
+	if (!sbegin) {
+		return NULL;
+	}
+	sbegin += strspn(sbegin,ct);
+	if (*sbegin == '\0') {
+		___strtok = NULL;
+		return( NULL );
+	}
+	send = strpbrk( sbegin, ct);
+	if (send && *send != '\0')
+		*send++ = '\0';
+	___strtok = send;
+	return (sbegin);
+}
+#endif
+
+#ifndef __HAVE_ARCH_MEMSET
+void * memset(void * s,char c,size_t count)
+{
+	char *xs = (char *) s;
+
+	while (count--)
+		*xs++ = c;
+
+	return s;
+}
+#endif
+
+#ifndef __HAVE_ARCH_BCOPY
+char * bcopy(const char * src, char * dest, int count)
+{
+	char *tmp = dest;
+
+	while (count--)
+		*tmp++ = *src++;
+
+	return dest;
+}
+#endif
+
+#ifndef __HAVE_ARCH_MEMCPY
+void * memcpy(void * dest,const void *src,size_t count)
+{
+	char *tmp = (char *) dest, *s = (char *) src;
+
+	while (count--)
+		*tmp++ = *s++;
+
+	return dest;
+}
+#endif
+
+#ifndef __HAVE_ARCH_MEMMOVE
+void * memmove(void * dest,const void *src,size_t count)
+{
+	char *tmp, *s;
+
+	if (dest <= src) {
+		tmp = (char *) dest;
+		s = (char *) src;
+		while (count--)
+			*tmp++ = *s++;
+		}
+	else {
+		tmp = (char *) dest + count;
+		s = (char *) src + count;
+		while (count--)
+			*--tmp = *--s;
+		}
+
+	return dest;
+}
+#endif
+
+#ifndef __HAVE_ARCH_MEMCMP
+int memcmp(const void * cs,const void * ct,size_t count)
+{
+	const unsigned char *su1, *su2;
+	signed char res = 0;
+
+	for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
+		if ((res = *su1 - *su2) != 0)
+			break;
+	return res;
+}
+#endif
+
+/*
+ * find the first occurrence of byte 'c', or 1 past the area if none
+ */
+#ifndef __HAVE_ARCH_MEMSCAN
+void * memscan(void * addr, int c, size_t size)
+{
+	unsigned char * p = (unsigned char *) addr;
+
+	while (size) {
+		if (*p == c)
+			return (void *) p;
+		p++;
+		size--;
+	}
+  	return (void *) p;
+}
+#endif
+
+#ifndef __HAVE_ARCH_STRSTR
+char * strstr(const char * s1,const char * s2)
+{
+	int l1, l2;
+
+	l2 = strlen(s2);
+	if (!l2)
+		return (char *) s1;
+	l1 = strlen(s1);
+	while (l1 >= l2) {
+		l1--;
+		if (!memcmp(s1,s2,l2))
+			return (char *) s1;
+		s1++;
+	}
+	return NULL;
+}
+#endif
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/tst-asm.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/tst-asm.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/tst-asm.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/tst-asm.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,19 @@
+void __premain()
+{
+  __asm__ volatile("clra\n\t"
+	                     "tap" : : : "d");
+}
+
+void inline foo()
+{
+  char* msg = "TEST STRING";
+  unsigned char code = 16;
+  
+  __asm__ __volatile__("jsr  0x7012"
+                       : : "x"(msg), "d"(code));
+}
+
+int main()
+{
+  ;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/vsprintf.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/vsprintf.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/compile-scz/vsprintf.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/compile-scz/vsprintf.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,320 @@
+/*
+ *  linux/lib/vsprintf.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
+/*
+ * Wirzenius wrote this portably, Torvalds fucked it up :-)
+ */
+
+#include <stdarg.h>
+/*#include <sys/types.h>*/
+/*#include <linux/string.h>*/
+/*#include <ctype.h> */
+
+#define isxdigit(c) (((c) >= '0' && (c) <= '9') || \
+                     ((c) >= 'a' && (c) <= 'f') || \
+                     ((c) >= 'A' && (c) <= 'F'))
+#define isdigit(c)  ((c) >= '0' && (c) <= '9')
+#define islower(c)  ((c) >= 'a')
+#define toupper(c)  ((c) - 'a' + 'A')
+
+unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
+{
+	unsigned long result = 0,value;
+
+	if (!base) {
+		base = 10;
+		if (*cp == '0') {
+			base = 8;
+			cp++;
+			if ((*cp == 'x') && isxdigit(cp[1])) {
+				cp++;
+				base = 16;
+			}
+		}
+	}
+	while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
+	    ? toupper(*cp) : *cp)-'A'+10) < base) {
+		result = result*base + value;
+		cp++;
+	}
+	if (endp)
+		*endp = (char *)cp;
+	return result;
+}
+
+/* we use this so that we can do without the ctype library */
+#define is_digit(c)	((c) >= '0' && (c) <= '9')
+
+static int skip_atoi(const char **s)
+{
+	int i=0;
+
+	while (is_digit(**s))
+		i = i*10 + *((*s)++) - '0';
+	return i;
+}
+
+#define ZEROPAD	1		/* pad with zero */
+#define SIGN	2		/* unsigned/signed long */
+#define PLUS	4		/* show plus */
+#define SPACE	8		/* space if plus */
+#define LEFT	16		/* left justified */
+#define SPECIAL	32		/* 0x */
+#define LARGE	64		/* use 'ABCDEF' instead of 'abcdef' */
+
+#define do_div(n,base) ({ \
+int __res; \
+__res = ((unsigned long) n) % (unsigned) base; \
+n = ((unsigned long) n) / (unsigned) base; \
+__res; })
+
+static char * number(char * str, long num, int base, int size, int precision
+	,int type)
+{
+	char c,sign,tmp[66];
+	const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
+	int i;
+
+	if (type & LARGE)
+		digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+	if (type & LEFT)
+		type &= ~ZEROPAD;
+	if (base < 2 || base > 36)
+		return 0;
+	c = (type & ZEROPAD) ? '0' : ' ';
+	sign = 0;
+	if (type & SIGN) {
+		if (num < 0) {
+			sign = '-';
+			num = -num;
+			size--;
+		} else if (type & PLUS) {
+			sign = '+';
+			size--;
+		} else if (type & SPACE) {
+			sign = ' ';
+			size--;
+		}
+	}
+	if (type & SPECIAL) {
+		if (base == 16)
+			size -= 2;
+		else if (base == 8)
+			size--;
+	}
+	i = 0;
+	if (num == 0)
+		tmp[i++]='0';
+	else while (num != 0)
+		tmp[i++] = digits[do_div(num,base)];
+	if (i > precision)
+		precision = i;
+	size -= precision;
+	if (!(type&(ZEROPAD+LEFT)))
+		while(size-->0)
+			*str++ = ' ';
+	if (sign)
+		*str++ = sign;
+	if (type & SPECIAL)
+		if (base==8)
+			*str++ = '0';
+		else if (base==16) {
+			*str++ = '0';
+			*str++ = digits[33];
+		}
+	if (!(type & LEFT))
+		while (size-- > 0)
+			*str++ = c;
+	while (i < precision--)
+		*str++ = '0';
+	while (i-- > 0)
+		*str++ = tmp[i];
+	while (size-- > 0)
+		*str++ = ' ';
+	return str;
+}
+
+int vsprintf(char *buf, const char *fmt, va_list args)
+{
+	int len;
+	unsigned long num;
+	int i, base;
+	char * str;
+	const char *s;
+
+	int flags;		/* flags to number() */
+
+	int field_width;	/* width of output field */
+	int precision;		/* min. # of digits for integers; max
+				   number of chars for from string */
+	int qualifier;		/* 'h', 'l', or 'L' for integer fields */
+
+	for (str=buf ; *fmt ; ++fmt) {
+		if (*fmt != '%') {
+			*str++ = *fmt;
+			continue;
+		}
+			
+		/* process flags */
+		flags = 0;
+		repeat:
+			++fmt;		/* this also skips first '%' */
+			switch (*fmt) {
+				case '-': flags |= LEFT; goto repeat;
+				case '+': flags |= PLUS; goto repeat;
+				case ' ': flags |= SPACE; goto repeat;
+				case '#': flags |= SPECIAL; goto repeat;
+				case '0': flags |= ZEROPAD; goto repeat;
+				}
+		
+		/* get field width */
+		field_width = -1;
+		if (is_digit(*fmt))
+			field_width = skip_atoi(&fmt);
+		else if (*fmt == '*') {
+			++fmt;
+			/* it's the next argument */
+			field_width = va_arg(args, int);
+			if (field_width < 0) {
+				field_width = -field_width;
+				flags |= LEFT;
+			}
+		}
+
+		/* get the precision */
+		precision = -1;
+		if (*fmt == '.') {
+			++fmt;	
+			if (is_digit(*fmt))
+				precision = skip_atoi(&fmt);
+			else if (*fmt == '*') {
+				++fmt;
+				/* it's the next argument */
+				precision = va_arg(args, int);
+			}
+			if (precision < 0)
+				precision = 0;
+		}
+
+		/* get the conversion qualifier */
+		qualifier = -1;
+		if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
+			qualifier = *fmt;
+			++fmt;
+		}
+
+		/* default base */
+		base = 10;
+
+		switch (*fmt) {
+		case 'c':
+			if (!(flags & LEFT))
+				while (--field_width > 0)
+					*str++ = ' ';
+			*str++ = (unsigned char) va_arg(args, int);
+			while (--field_width > 0)
+				*str++ = ' ';
+			continue;
+
+		case 's':
+			s = va_arg(args, char *);
+			if (!s)
+				s = "<NULL>";
+
+			len = strlen(s);
+                        if (len > precision && precision >= 0)
+                          len = precision;
+
+			if (!(flags & LEFT))
+				while (len < field_width--)
+					*str++ = ' ';
+			for (i = 0; i < len; ++i)
+				*str++ = *s++;
+			while (len < field_width--)
+				*str++ = ' ';
+			continue;
+
+		case 'p':
+			if (field_width == -1) {
+				field_width = 2*sizeof(void *);
+				flags |= ZEROPAD;
+			}
+			str = number(str,
+				(unsigned long) va_arg(args, void *), 16,
+				field_width, precision, flags);
+			continue;
+
+
+		case 'n':
+			if (qualifier == 'l') {
+				long * ip = va_arg(args, long *);
+				*ip = (str - buf);
+			} else {
+				int * ip = va_arg(args, int *);
+				*ip = (str - buf);
+			}
+			continue;
+
+		/* integer number formats - set up the flags and "break" */
+		case 'o':
+			base = 8;
+			break;
+
+		case 'X':
+			flags |= LARGE;
+		case 'x':
+			base = 16;
+			break;
+
+		case 'd':
+		case 'i':
+			flags |= SIGN;
+		case 'u':
+			break;
+
+                        /* For GCC test gcc.c-torture/execute/ieee/920810-1.c */
+                case 'g':
+                  *str++ = '0';
+                  continue;
+                  
+		default:
+			if (*fmt != '%')
+				*str++ = '%';
+			if (*fmt)
+				*str++ = *fmt;
+			else
+				--fmt;
+			continue;
+		}
+		if (qualifier == 'l')
+			num = va_arg(args, unsigned long);
+		else if (qualifier == 'h')
+			if (flags & SIGN)
+				num = va_arg(args, int);
+			else
+				num = va_arg(args, unsigned int);
+		else if (flags & SIGN)
+			num = va_arg(args, int);
+		else
+			num = va_arg(args, unsigned int);
+		str = number(str, num, base, field_width, precision, flags);
+	}
+	*str = '\0';
+	return str-buf;
+}
+
+int sprintf(char * buf, const char *fmt, ...)
+{
+	va_list args;
+	int i;
+
+	va_start(args, fmt);
+	i=vsprintf(buf,fmt,args);
+	va_end(args);
+	return i;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/20020404-1.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/20020404-1.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/20020404-1.x	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/20020404-1.x	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,6 @@
+# This test fails on HC11/HC12 when it is compiled with 16-bit integers
+# because it passes value 0x1eadbeef in an int.
+if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } {
+    return 1
+}
+return 0
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/20020720-1.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/20020720-1.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/20020720-1.x	Mon Jan  3 02:43:45 2005
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/20020720-1.x	Sat Nov  5 19:17:25 2005
@@ -29,7 +29,7 @@ set torture_eval_before_compile {
     set compiler_conditional_xfail_data {
         "This test fails to optimize completely on certain platforms." \
         { "xtensa-*-*" "sh-*-*" "arm*-*-*" "strongarm*-*-*" "xscale*-*-*" \
-	  "h8300*-*-*" "x86_64-*-*" "cris-*-*" } \
+	  "h8300*-*-*" "x86_64-*-*" "cris-*-*" "m6811-*-*" "m6812-*-*" } \
         { "*" } \
         { "-O0" }
     }
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/20021024-1.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/20021024-1.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/20021024-1.x	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/20021024-1.x	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,10 @@
+# 16-bit "int"
+if { [istarget "xstormy16-*"] } {
+	return 1
+}
+if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} {
+	return 1
+}
+
+return 0
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/960312-1.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/960312-1.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/960312-1.x	Sun Mar  2 23:35:16 2003
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/960312-1.x	Sat Nov  5 19:17:25 2005
@@ -2,6 +2,6 @@
 # is uses an asm that requires two 32-bit registers (int).  It passes
 # when using -mshort because there are enough registers;  force -mshort.
 if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } {
-	set options "-mshort"
+	set additional_flags "-mshort"
 }
 return 0
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,7 @@
+# sprintf %g is not supported on HC11/HC12 (too big for a final link)
+if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} {
+	return 1
+}
+
+return 0
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/shiftdi.x gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/shiftdi.x
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute/shiftdi.x	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute/shiftdi.x	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,10 @@
+# 16-bit "int"
+if { [istarget "xstormy16-*"] } {
+	return 1
+}
+if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"]} {
+	return 1
+}
+
+return 0
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/andqi.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/andqi.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/andqi.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/andqi.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,52 @@
+signed char value;
+
+signed char values[] = {
+  0, 1, 2, 3, 5, 7, 9, 16, 127, 128
+};
+
+signed char expect[] = {
+  0, 0, 0, 0, 4, 4, 8, 0, 12, 0
+};
+
+void
+andqi_global ()
+{
+  value &= 12;
+}
+
+void
+andqi_ptr (signed char* p)
+{
+  *p &= 12;
+}
+
+signed char
+andqi_return (signed char v)
+{
+  return v & 12;
+}
+
+int
+main()
+{
+  unsigned i;
+  signed char c;
+  
+  for (i = 0; i < sizeof(values) / sizeof(values[0]); i++)
+    {
+      value = values[i];
+      andqi_global ();
+      if (value != expect[i])
+        abort ();
+
+      c = values[i];
+      andqi_ptr (&c);
+      if (c != expect[i])
+        abort ();
+
+      c = andqi_return (values[i]);
+      if (c != expect[i])
+        abort ();
+    }
+  exit (0);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/autoinc.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/autoinc.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/autoinc.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/autoinc.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,70 @@
+void
+post_inc_short (unsigned short *dst, unsigned short *src)
+{
+  *dst++ = *src++;
+  *dst++ = 0xabcd;
+  *dst++ = src[2];
+  *dst = *src++;
+}
+
+void
+pre_inc_short (unsigned short *dst, unsigned short *src)
+{
+  *++dst = *++src;
+  *++dst = 0xabcd;
+  *++dst = src[3];
+  *++dst = *++src;
+}
+
+
+void
+post_inc_long (unsigned long *dst, unsigned long *src)
+{
+  *dst++ = *src++;
+  *dst++ = 0xabcdef23;
+  *dst++ = src[2];
+  *dst = *src++;
+}
+
+void
+pre_inc_long (unsigned long *dst, unsigned long *src)
+{
+  *++dst = *++src;
+  *++dst = 0xabcdef23;
+  *++dst = src[3];
+  *++dst = *++src;
+}
+
+int
+main ()
+{
+  unsigned short dst[10];
+  unsigned short src[10];
+  unsigned long dstl[10];
+  unsigned long srcl[10];
+
+  src[0] = 0x1234;
+  src[1] = 0x2345;
+  src[3] = 0x3456;
+  src[4] = 0x4567;
+  post_inc_short (dst, src);
+  if (dst[0] != 0x1234 || dst[1] != 0xabcd
+      || dst[2] != 0x3456 || dst[3] != 0x2345)
+    abort ();
+
+  srcl[0] = 0x12345678;
+  srcl[1] = 0x23456789;
+  srcl[3] = 0x3456789a;
+  srcl[4] = 0x456789ab;
+  post_inc_long (dstl, srcl);
+  if (dstl[0] != 0x12345678 || dstl[1] != 0xabcdef23
+      || dstl[2] != 0x3456789a || dstl[3] != 0x23456789)
+    abort ();
+
+  pre_inc_long (dstl, &srcl[-1]);
+  if (dstl[1] != 0x12345678 || dstl[2] != 0xabcdef23
+      || dstl[3] != 0x3456789a || dstl[4] != 0x23456789)
+    abort ();
+
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/b-20010414.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/b-20010414.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/b-20010414.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/b-20010414.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,55 @@
+enum v {
+  L1, L2, L3
+};
+void bar();
+
+int
+get(unsigned char a, unsigned char b, long *c, enum v d)
+{
+  int i, j;
+
+  bar ();
+  switch (d)
+    {
+    case L1:
+      i = 1;
+      break;
+
+    case L2:
+      i = b;
+      break;
+
+    case L3:
+      i = *c;
+      break;
+    }
+  j = 0;
+  while (i > 0)
+    {
+      j += i;
+      i--;
+    }
+  return j;
+}
+
+void
+bar()
+{
+  ;
+}
+
+int
+main ()
+{
+  long a = 0x12345678;
+  int result;
+  
+  result = get (1, 2, &a, L2);
+  if (a != 0x12345678)
+    abort ();
+
+  if (result != 3)
+    abort ();
+  
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/b-20020520.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/b-20020520.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/b-20020520.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/b-20020520.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,13 @@
+ static  struct {
+     unsigned int b0 : 1;
+   int v : 4;
+   int b : 8;
+  }tester;
+
+int main()
+{
+  tester.b = 4;
+  tester.v = 2;
+  return tester.b0;
+}
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/b-20040816.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/b-20040816.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/b-20040816.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/b-20040816.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,22 @@
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned long uint32_t;
+
+uint32_t test;
+
+void shl(uint8_t Nr)
+{
+    test |= (1L<<Nr);
+}
+ 
+int main(void)
+{
+  test = 1;
+  shl(2);
+  if (test != 5L)
+     return 1;
+  shl(17);
+  if (test != (5L | (1L << 17)))
+     return 1;
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/b-20051105.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/b-20051105.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/b-20051105.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/b-20051105.c	Sat Nov  5 21:14:46 2005
@@ -0,0 +1,79 @@
+struct fields
+{
+  unsigned long long u1 : 15;
+  unsigned long long u2 : 33;
+  unsigned long long u3 : 16;
+  signed long long   s1 : 15;
+  signed long long   s2 : 33;
+  signed long long   s3 : 16;
+} flags;
+
+struct sfields
+{
+  unsigned long u1 : 15;
+  unsigned long u2 : 17;
+  unsigned long u3 : 16;
+  signed long    s1 : 15;
+  signed long    s2 : 17;
+  signed long    s3 : 16;
+} sflags;
+
+void break1()
+{
+}
+
+#define FIELD(S,VAL,CODE) \
+  flags.S = VAL;          \
+  break1();               \
+  if (flags.S != VAL) {   \
+    return CODE;          \
+  }
+
+#define CHECK_U2(CODE) \
+  FIELD(u2,1,CODE+1);        \
+  FIELD(u2,2,CODE+1);        \
+  FIELD(u2,0x100,CODE+1);     \
+  FIELD(u2,0xabcd,CODE+1);    \
+  FIELD(u2,0x12ab34cd,CODE+1)
+
+#define CHECK_S2(CODE) \
+  FIELD(s2,1,CODE+1);        \
+  FIELD(s2,2,CODE+1);        \
+  FIELD(s2,0x100,CODE+1);     \
+  FIELD(s2,0xabcd,CODE+1);    \
+  FIELD(s2,0x12ab34cd,CODE+1)
+
+int main() 
+{
+  flags.s2 = 1;
+  break1();
+  if (flags.s2 != 1)
+    return 1;
+
+  flags.u2 = 0x1aaaaffffLL;
+  break1();
+  if (flags.u2 != 0x1aaaaffffLL)
+    return 2;
+  
+  flags.u2 = ~0x1aaaaffffLL;
+  break1();
+  if (flags.u2 != 0x055550000LL)
+    return 3;
+
+  sflags.s2 = 1;
+  break1();
+  if (sflags.s2 != 1)
+    return 4;
+
+  sflags.u2 = 0x1aaffL;
+  break1();
+  if (sflags.u2 != 0x1aaffL)
+    return 5;
+  
+  sflags.u2 = ~0x1aaffL;
+  if (sflags.u2 != 0x5500L)
+    return 6;
+
+  CHECK_U2(50);
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/bigmul.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/bigmul.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/bigmul.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/bigmul.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,29 @@
+long a = 10000;
+long b = 200000;
+unsigned long c = 100000;
+unsigned long d = 20000;
+long long e = 100000000LL;
+long long f = 200000000LL;
+
+int main()
+{
+  long r;
+  unsigned long p;
+  long long q;
+  
+  r = a * b;
+  if (r != 10000 * 200000)
+    return 1;
+
+  p = c * d;
+  if (p != 100000 * 20000)
+    return 1;
+
+  q = e * f;
+  if (q != 100000000LL * 200000000LL)
+    return 1;
+  
+  return 0;
+}
+
+  
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/bit.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/bit.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/bit.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/bit.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,95 @@
+unsigned
+bit_char (unsigned char n)
+{
+  unsigned cnt = 0;
+
+  if (n & 1) cnt++;
+  if (n & 2) cnt++;
+  if (n & 4) cnt++;
+  if (n & 8) cnt++;
+  if (n & 16) cnt++;
+  if (n & 32) cnt++;
+  if (n & 64) cnt++;
+  if (n & 128) cnt++;
+  return cnt;
+}
+
+unsigned
+bit_short (unsigned short n)
+{
+  unsigned cnt = 0;
+
+  if (n & 1) cnt++;
+  if (n & 128) cnt++;
+  if (n & 256) cnt++;
+  if (n & 0x8000) cnt++;
+
+  return cnt + bit_char (n) + bit_char (n >> 8);
+}
+
+unsigned
+bit_ulong (unsigned long n)
+{
+  unsigned cnt = 0;
+
+  if (n & 1) cnt++;
+  if (n & 0x8000) cnt++;  
+  if (n & 0x10000) cnt++;
+  if (n & 0x80000000) cnt++;
+  return cnt + bit_short (n) + bit_short (n >> 16);
+}
+
+unsigned
+bit_ulonglong (unsigned long long n)
+{
+  unsigned cnt = 0;
+
+  if (n & 1LL) cnt++;
+  if (n & 0x80000000LL) cnt++;  
+  if (n & 0x100000000LL) cnt++;
+  if (n & 0x8000000000000000LL) cnt++;
+  return cnt + bit_ulong (n) + bit_ulong (n >> 32);
+}
+
+int
+main ()
+{
+  long long n;
+  int i, j;
+  unsigned cnt_char, cnt_short, cnt_long, cnt_longlong;
+  
+  for (i = 0; i < 64; i++)
+    {
+      n = (1LL << i);
+      cnt_char = 0;
+      cnt_short = 0;
+      cnt_long  = 0;
+      cnt_longlong = bit_ulonglong (n);
+      for (j = 0; j < 8; j++)
+	{
+	  cnt_char += bit_char (n >> (j * 8));
+	  if ((j & 1) == 0)
+	    cnt_short += bit_short (n >> (j * 8));
+
+	  if ((j & 3) == 0)
+	    cnt_long += bit_ulong (n >> (j * 8));
+	}
+#if 0
+      printf ("%d: %d %d %d %d\n", i, cnt_char, cnt_short,
+	      cnt_long, cnt_longlong);
+#endif
+      if ((i % 8) == 0 || (i % 8) == 7)
+	cnt_short --, cnt_long --, cnt_longlong --;
+
+      if ((i % 16) == 0 || (i % 16) == 15)
+	cnt_long --, cnt_longlong --;
+
+      if ((i % 32) == 0 || (i % 32) == 31)
+	cnt_longlong --;
+
+      if (cnt_short != cnt_char || cnt_short != cnt_long
+	  || cnt_long != cnt_longlong || cnt_char != 1)
+	exit (1);
+    }
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/bitfield.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/bitfield.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/bitfield.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/bitfield.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,328 @@
+struct bfield 
+{
+  int b1 : 1;
+  int b2 : 2;
+  int b3 : 3;
+  int b4 : 4;
+  int b5 : 5;
+  int b6 : 6;
+  int b7 : 7;
+  int b8 : 8;
+  int b9 : 9;
+  int b10: 10;
+  int b11: 11;
+  int b12: 12;
+  int b13: 13;
+  int b14: 14;
+  int b15: 15;
+};
+
+struct bfield
+fillup (int value)
+{
+  struct bfield bf;
+
+  bf.b1 = value;
+  bf.b2 = value;
+  bf.b3 = value;
+  bf.b4 = value;
+  bf.b5 = value;
+  bf.b6 = value;
+  bf.b7 = value;
+  bf.b8 = value;
+  bf.b9 = value;
+  bf.b10 = value;
+  bf.b11 = value;
+  bf.b12 = value;
+  bf.b13 = value;
+  bf.b14 = value;
+  bf.b15 = value;
+  return bf;
+}
+
+int
+compare (struct bfield b1, struct bfield b2)
+{
+  if (b1.b1 != b2.b1)
+    return 1;
+  if (b1.b2 != b2.b2)
+    return 2;
+  if (b1.b3 != b2.b3)
+    return 3;
+  if (b1.b4 != b2.b4)
+    return 4;
+  if (b1.b5 != b2.b5)
+    return 5;
+  if (b1.b6 != b2.b6)
+    return 6;
+  if (b1.b7 != b2.b7)
+    return 7;
+  if (b1.b8 != b2.b8)
+    return 8;
+  if (b1.b9 != b2.b9)
+    return 9;
+  if (b1.b10 != b2.b10)
+    return 10;
+  if (b1.b11 != b2.b11)
+    return 11;
+  if (b1.b12 != b2.b12)
+    return 12;
+  if (b1.b13 != b2.b13)
+    return 13;
+  if (b1.b14 != b2.b14)
+    return 14;
+  if (b1.b15 != b2.b15)
+    return 15;
+
+  return 0;
+}
+
+int
+expect_value (int n, int bits)
+{
+  if (n & (1 << (bits - 1)))
+    return (n & ((1 << bits) - 1)) | ~((1 << bits) - 1);
+  else
+    return (n & ((1 << bits) - 1));
+}
+
+
+int
+main ()
+{
+  long long n;
+  long i, j;
+  unsigned cnt_char, cnt_short, cnt_long, cnt_longlong;
+  struct bfield b1, b2;
+  
+  for (i = 0; i < 32768; )
+    {
+      int res;
+
+      b1 = fillup (i);
+      b2 = fillup (i);
+#define exit(P) {printf ("At %d\n", __LINE__); return 1; }
+
+      if (b1.b1 != expect_value (i, 1))
+	exit (1);
+      if (b1.b2 != expect_value (i, 2))
+	exit (1);
+      if (b1.b3 != expect_value (i, 3))
+	exit (1);
+      if (b1.b4 != expect_value (i, 4))
+	exit (1);
+      if (b1.b5 != expect_value (i, 5))
+	exit (1);
+      if (b1.b6 != expect_value (i, 6))
+	exit (1);
+      if (b1.b7 != expect_value (i, 7))
+	exit (1);
+      if (b1.b8 != expect_value (i, 8))
+	exit (1);
+      if (b1.b9 != expect_value (i, 9))
+	exit (1);
+      if (b1.b10 != expect_value (i, 10))
+	exit (1);
+      if (b1.b11 != expect_value (i, 11))
+	exit (1);
+      if (b1.b12 != expect_value (i, 12))
+	exit (1);
+      if (b1.b13 != expect_value (i, 13))
+	exit (1);
+      if (b1.b14 != expect_value (i, 14))
+	exit (1);
+
+      if (b1.b15 != expect_value (i, 15))
+	exit (1);
+
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B1 */
+      b2.b1 = ~b2.b1;
+      res = compare (b1, b2);
+      if (res != 1)
+	exit (1);
+
+      b2.b1 = b1.b1;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+      
+      /* B2 */
+      b2.b2 = ~b2.b2;
+      res = compare (b1, b2);
+      if (res != 2)
+	exit (1);
+
+      b2.b2 = b1.b2;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+      
+      /* B3 */
+      b2.b3 = ~b2.b3;
+      res = compare (b1, b2);
+      if (res != 3)
+	exit (1);
+
+      b2.b3 = b1.b3;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+      
+      /* B4 */
+      b2.b4 = ~b2.b4;
+      res = compare (b1, b2);
+      if (res != 4)
+	exit (1);
+
+      b2.b4 = b1.b4;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+      
+      /* B5 */
+      b2.b5 = ~b2.b5;
+      res = compare (b1, b2);
+      if (res != 5)
+	exit (1);
+
+      b2.b5 = b1.b5;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B6 */
+      b2.b6 = ~b2.b6;
+      res = compare (b1, b2);
+      if (res != 6)
+	exit (1);
+
+      b2.b6 = b1.b6;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B7 */
+      b2.b7 = ~b2.b7;
+      res = compare (b1, b2);
+      if (res != 7)
+	exit (1);
+
+      b2.b7 = b1.b7;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B8 */
+      b2.b8 = ~b2.b8;
+      res = compare (b1, b2);
+      if (res != 8)
+	exit (1);
+
+      b2.b8 = b1.b8;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B9 */
+      b2.b9 = ~b2.b9;
+      res = compare (b1, b2);
+      if (res != 9)
+	exit (1);
+
+      b2.b9 = b1.b9;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B10 */
+      b2.b10 = ~b2.b10;
+      res = compare (b1, b2);
+      if (res != 10)
+	exit (1);
+
+      b2.b10 = b1.b10;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B10 */
+      b2.b10 = ~b2.b10;
+      res = compare (b1, b2);
+      if (res != 10)
+	exit (1);
+
+      b2.b10 = b1.b10;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B11 */
+      b2.b11 = ~b2.b11;
+      res = compare (b1, b2);
+      if (res != 11)
+	exit (1);
+
+      b2.b11 = b1.b11;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B12 */
+      b2.b12 = ~b2.b12;
+      res = compare (b1, b2);
+      if (res != 12)
+	exit (1);
+
+      b2.b12 = b1.b12;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B13 */
+      b2.b13 = ~b2.b13;
+      res = compare (b1, b2);
+      if (res != 13)
+	exit (1);
+
+      b2.b13 = b1.b13;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B14 */
+      b2.b14 = ~b2.b14;
+      res = compare (b1, b2);
+      if (res != 14)
+	exit (1);
+
+      b2.b14 = b1.b14;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      /* B15 */
+      b2.b15 = ~b2.b15;
+      res = compare (b1, b2);
+      if (res != 15)
+	exit (1);
+
+      b2.b15 = b1.b15;
+      res = compare (b1, b2);
+      if (res != 0)
+	exit (1);
+
+      if (i < 300)
+        {
+          i++;
+        }
+      else
+        {
+          i += 119;
+        }
+    }
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/bset.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/bset.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/bset.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/bset.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,13 @@
+/* Handle GEL page0 indications.  The global/static variables
+   specified with that attribute will be put within page0.  */
+#define PAGE0_ATTRIBUTE __attribute__((section(".page0")))
+
+char var PAGE0_ATTRIBUTE;
+
+int main()
+{
+  var |= 1;
+  if (var & 2)
+    var &= 8;
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/execute.exp gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/execute.exp
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/execute.exp	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/execute.exp	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,43 @@
+# Copyright (C) 1991, 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
+
+# This file was written by Rob Savoye. (rob@cygnus.com)
+# Modified and maintained by Jeffrey Wheat (cassidy@cygnus.com)
+
+#
+# These tests come from Torbjorn Granlund (tege@cygnus.com)
+# C torture test suite.
+#
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+# load support procs
+load_lib c-torture.exp
+
+#
+# main test loop
+#
+
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
+    # If we're only testing specific files and this isn't one of them, skip it.
+    if ![runtest_file_p $runtests $src] then {
+	continue
+    }
+
+    c-torture-execute $src
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/malloc.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/malloc.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/malloc.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/malloc.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,32 @@
+#include <stdlib.h>
+#include <string.h>
+
+int main()
+{
+  char *p[100];
+  int i, j;
+  
+  for (i = 0; i < 100; i++)
+    {
+      p[i] = malloc (40);
+      /* printf ("p[%d] = 0x%02x\n", i, p[i]); */
+    }
+
+  for (i = 0; i < 10; i++)
+    for (j = 0; j < 32; j++)
+      p[i][j] = i + j + ' ';
+
+  for (i = 0; i < 10; i++)
+    p[i][32] = 0;
+
+  for (i = 0; i < 10; i++)
+    for (j = 0; j < 10; j++)
+      if (i == j)
+        {
+          if (strcmp (p[i], p[j]) != 0)
+            return 1;
+        }
+      else if (strcmp (p[i], p[j]) == 0)
+        return 1;
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/memset-2003-01-25.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/memset-2003-01-25.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/memset-2003-01-25.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/memset-2003-01-25.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,9 @@
+#include <string.h>
+
+char foo[10];
+
+int main()
+{
+  memset (foo, 1, sizeof (foo));
+  return foo[0] - 1;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/mul-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/mul-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/mul-1.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/mul-1.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,114 @@
+unsigned char
+frac_char (unsigned char n)
+{
+  if (n > 1)
+    return n * frac_char (n - 1);
+  else
+    return 1;
+}
+
+unsigned short
+frac_ushort (unsigned short n)
+{
+  if (n > 1)
+    return n * frac_ushort (n - 1);
+  else
+    return 1;
+}
+
+short
+frac_short (short n)
+{
+  if (n > 1)
+    return n * frac_short (n - 1);
+  else
+    return 1;
+}
+
+unsigned long
+frac_ulong (unsigned long n)
+{
+  if (n > 1)
+    return n * frac_ulong (n - 1);
+  else
+    return 1;
+}
+
+long
+frac_long (long n)
+{
+  if (n > 1)
+    return n * frac_long (n - 1);
+  else
+    return 1;
+}
+
+unsigned long long
+frac_ulonglong (unsigned long long n)
+{
+  if (n > 1)
+    return n * frac_ulonglong (n - 1);
+  else
+    return 1;
+}
+
+long long
+frac_longlong (long long n)
+{
+  if (n > 1)
+    return n * frac_longlong (n - 1);
+  else
+    return 1;
+}
+
+long long ftable[] = {
+  1, 2, 6, 24, 120, 720, 5040, 40320, 362880,
+  3628800, 39916800, 479001600, 6227020800,
+  87178291200, 1307674368000, 20922789888000,
+  355687428096000, 6402373705728000, 121645100408832000,
+  2432902008176640000
+};
+
+void
+error (char *func, int n, long long result)
+{
+  printf ("Failed: %s (%d) => %lld\n", func, n, result);
+  exit (1);
+}
+
+int
+main ()
+{
+  int i;
+
+  for (i = 0; i < sizeof(ftable) / sizeof(ftable[0]); i++)
+    {
+      if (ftable[i] < 256)
+	{
+	  if (frac_char (i+1) != ftable[i])
+	    error ("frac_char", i, (long long) frac_char (i+1));
+	}
+      if (ftable[i] < 65536)
+	{
+	  if (ftable[i] <= 32767 && frac_short (i+1) != ftable[i])
+	    error ("frac_short", i, (long long) frac_short (i+1));
+
+	  if (frac_ushort (i+1) != ftable[i])
+	    error ("frac_ushort", i, (long long) frac_ushort (i+1));
+	}
+      if (ftable[i] < 65536*65536)
+	{
+	  if (ftable[i] <= 0x7ffffffffL && frac_long (i+1) != ftable[i])
+	    error ("frac_long", i, (long long) frac_long (i+1));
+
+	  if (frac_ulong (i+1) != ftable[i])
+	    error ("frac_ulong", i, (long long) frac_ulong (i+1));
+	}
+      if (frac_longlong (i+1) != ftable[i])
+	error ("frac_longlong", i, frac_longlong (i+1));
+
+      if (frac_ulonglong (i+1) != ftable[i])
+	error ("frac_ulonglong", i, frac_ulonglong (i+1));      
+    }
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/negqi.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/negqi.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/negqi.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/negqi.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,64 @@
+signed char value;
+
+signed char values[] = {
+  0, 1, 2, 3, 5, 7, 9, 16, 127, 128
+};
+
+signed char expect[] = {
+  0, -1, -2, -3, -5, -7, -9, -16, -127, 128
+};
+
+void
+negqi_global ()
+{
+  value = - value;
+}
+
+void
+negqi_ptr (signed char* p)
+{
+  *p = - *p;
+}
+
+signed char
+negqi_return (signed char v)
+{
+  return -v;
+}
+
+int
+main()
+{
+  unsigned i;
+  signed char c;
+  
+  for (i = 0; i < sizeof(values) / sizeof(values[0]); i++)
+    {
+      value = values[i];
+      negqi_global ();
+      if (value != expect[i])
+        abort ();
+
+      negqi_global ();
+      if (value != values[i])
+        abort ();
+
+      c = value;
+      negqi_ptr (&c);
+      if (c != expect[i])
+        abort ();
+
+      negqi_ptr (&c);
+      if (c != values[i])
+        abort ();
+
+      c = negqi_return (c);
+      if (c != expect[i])
+        abort ();
+
+      c = negqi_return (c);
+      if (c != values[i])
+        abort ();
+    }
+  exit (0);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/orqi.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/orqi.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/orqi.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/orqi.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,52 @@
+signed char value;
+
+signed char values[] = {
+  0,  1,  2,  3,  5,  7, 9, 16, 127, 128
+};
+
+signed char expect[] = {
+ 12, 13, 14, 15, 13, 15, 13, 28, 127, 140
+};
+
+void
+orqi_global ()
+{
+  value |= 12;
+}
+
+void
+orqi_ptr (signed char* p)
+{
+  *p |= 12;
+}
+
+signed char
+orqi_return (signed char v)
+{
+  return v | 12;
+}
+
+int
+main()
+{
+  unsigned i;
+  signed char c;
+  
+  for (i = 0; i < sizeof(values) / sizeof(values[0]); i++)
+    {
+      value = values[i];
+      orqi_global ();
+      if (value != expect[i])
+        abort ();
+
+      c = values[i];
+      orqi_ptr (&c);
+      if (c != expect[i])
+        abort ();
+
+      c = orqi_return (values[i]);
+      if (c != expect[i])
+        abort ();
+    }
+  exit (0);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-11741.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-11741.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-11741.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-11741.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,59 @@
+typedef short bsdstuff_size_t;
+char *strncpy(char *dst, const char *src, bsdstuff_size_t n)
+{
+  // printf("src=%s\r\n", src);
+  // printf("size=%d", n);
+  if (n != 0) {
+    char *d = dst;
+    const char *s = src;
+    
+    do {
+      if ((*d++ = *s++) == 0) {
+        /* NUL pad the remaining n-1 bytes */
+        while (--n != 0)
+          *d++ = 0;
+        break;
+      }
+    } while (--n != 0);
+  }
+  //printf("dst=%s\r\n", dst);
+  
+  return (dst);
+  
+}
+
+static const char* strings[] = {
+  "hello world",
+  "a",
+  "bb",
+  "0123456789012234568",
+  "asfasfsgdhtrhwrthrhwvdvegqeasdfasf",
+  0
+};
+
+int
+main ()
+{
+  char buf[64];
+  char *p;
+  int i;
+
+  for (i = 0; strings[i] != 0; i++)
+    {
+      memset (buf, 1, sizeof (buf));
+      if (buf[3] != 1 || buf[12] != 1 || buf[sizeof (buf) - 1] != 1)
+        abort ();
+
+      p = strncpy (buf, strings[i], sizeof (buf));
+      if (buf[sizeof (buf) - 1] != 0)
+        abort ();
+      if (p != buf)
+        abort ();
+
+      if (buf[0] != strings[i][0])
+        abort ();
+      if (strcmp (buf, strings[i]) != 0)
+        abort ();
+    }
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-12243.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-12243.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-12243.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-12243.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,27 @@
+static unsigned char spi_test1[256];
+
+void fnTest(void)
+{
+  unsigned short i;
+   
+  for (i = 0; i < sizeof(spi_test1); i++) 
+    {
+      spi_test1[i] = (unsigned char)i;
+    }
+}
+
+void main(void)
+{
+  fnTest ();
+  
+  if (spi_test1[0] != 0)
+    exit (1);
+
+  if (spi_test1[1] != 1)
+    exit (2);
+
+  if (spi_test1[10] != 10)
+    exit (3);
+
+  exit (0);
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-12297.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-12297.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-12297.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-12297.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,50 @@
+unsigned long lsqrt (unsigned long x)
+{
+	if (x <= 1)
+		return x;
+
+	/* If 'x' is small enough, use 16-bit integers.  */
+	if ((x & 0xFFFF0000L) == 0)
+	{
+		unsigned short v0, x0, q0, x1;
+
+		v0 = (unsigned short) (x);
+		x0 = v0 / 2;
+		while (1)
+		{
+			q0 = v0 / x0;
+			x1 = (x0 + q0) / 2;
+			if (q0 >= x0)
+				break;
+			x0 = x1;
+		}
+		return (unsigned long) x1;
+	}
+	else
+	{
+		unsigned long v0, q0, x1;
+
+		v0 = x;
+		x = x / 2;
+		while (1)
+		{
+			q0 = v0 / x;
+			x1 = (x + q0) / 2;
+			if (q0 >= x)
+				break;
+			x = x1;
+		}
+		return x1;
+	}
+}
+
+int main ()
+{
+  unsigned long result = lsqrt (40);
+  if (result != 6)
+    exit (1);
+
+  return 0;
+}
+
+
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-13917.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-13917.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-13917.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-13917.c	Sat Nov  5 22:12:59 2005
@@ -0,0 +1,50 @@
+#include <string.h>
+
+void ltoa(char *buf, unsigned long i, int base);
+
+void ltoa(char *buf, unsigned long i, int base)
+{
+  char *s;
+#define LEN 25
+  int rem;
+  char rev[LEN+1];
+
+  if (i == 0)
+    s = "0";
+  else
+    {
+      rev[LEN] = 0;
+      s = &rev[LEN];
+      while (i)
+        {
+          rem = i % base;
+          if (rem < 10)
+            *--s = rem + '0'; // >>>>>>>> Here appears the error.
+          else
+            if (base == 16)
+              *--s = "abcdef"[rem - 10];
+          i /= base;
+        }
+    }
+  strcpy(buf, s);
+}
+
+int main()
+{
+  char buf[32];
+
+  ltoa(buf, 0x123456, 10);
+  if (strcmp(buf, "1193046") != 0)
+    return 1;
+  
+  ltoa(buf, 0x2345678, 13);
+  if (strcmp(buf, "7870") != 0)
+    return 1;
+  
+  ltoa(buf, 0xabcdef0, 16);
+  if (strcmp(buf, "abcdef0") != 0)
+    return 1;
+  
+  /* Also check that the strcmp detects strings not equal!  */
+  return strcmp(buf, "bcde") != 0 ? 0 : 1;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-15493.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-15493.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/pr-15493.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/pr-15493.c	Wed Jan 25 21:18:05 2006
@@ -0,0 +1,57 @@
+#ifdef mc68hc1x
+/* The softregs start at address 0.  The test needs to write
+   at 0x0 to verify that the 'mebi->dirX = 0' are fixed.
+   We use this padding scratch area to make sure the soft
+   registers do not start at 0. */
+char __attribute__((section(".page0"))) scratch[0x20] = { 0 };
+#endif
+
+typedef struct
+{
+   volatile unsigned char portA;
+   volatile unsigned char  portB;
+   volatile unsigned char  dirA;
+   volatile unsigned char  dirB;
+} MEBI_Regs;
+
+void ReadExternalBus( unsigned int addr )
+{
+   MEBI_Regs *mebi = (MEBI_Regs*)0;
+
+   // Write the address to the port A and B registers
+   mebi->portB = addr;
+   mebi->portA = addr>>8;
+
+   // Change ports A and B to inputs
+   mebi->dirA = 0;
+   mebi->dirB = 0;
+}
+
+void check(MEBI_Regs* p, unsigned char a, unsigned char b)
+{
+  if (p->portA != a)
+    abort();
+  if (p->portB != b)
+    abort();
+  if (p->dirA != 0)
+    abort();
+  if (p->dirB != 0)
+    abort();
+}
+
+int main( void )
+{
+#ifdef mc68hc1x
+  char* p = (char*) 0;
+  unsigned short i;
+  
+  for (i = 0x20; i > 0; i--)
+    *p++ = 0xaa;
+
+#endif
+  ReadExternalBus( 0x1000 );
+#ifdef mc68hc1x
+  check(0, 0x10, 0);
+#endif
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/setjmp-test.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/setjmp-test.c
--- gcc-3.3.6/gcc/testsuite/gcc.c-torture/execute-scz/setjmp-test.c	Thu Jan  1 01:00:00 1970
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.c-torture/execute-scz/setjmp-test.c	Sat Nov  5 19:17:25 2005
@@ -0,0 +1,50 @@
+#include <stdio.h>
+#include <setjmp.h>
+
+jmp_buf jbuf;
+int jret;
+
+int
+fact (int n)
+{
+  if (n <= 1)
+    {
+      if (jret)
+        longjmp (jbuf, jret);
+      
+      return 1;
+    }
+  else
+    {
+      return fact (n - 1) * n;
+    }
+}
+
+int
+compute (int n)
+{
+  int result;
+
+  result = setjmp (jbuf);
+  if (result != 0)
+    return result;
+
+  result = fact (n);
+  return result * n;
+}
+
+int
+main ()
+{
+  int result;
+
+  result = compute (4);
+  if (result != 96)
+    abort ();
+  
+  jret = 23;
+  result = compute (4);
+  if (result != 23)
+    abort ();
+  return 0;
+}
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20001009-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20001009-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20001009-1.c	Fri Mar 15 06:36:37 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20001009-1.c	Sat Nov  5 19:17:25 2005
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fpic" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 extern void foo (void *a, double x, double y);
 void
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20010912-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20010912-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20010912-1.c	Fri Mar 15 06:36:37 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20010912-1.c	Sat Nov  5 19:17:25 2005
@@ -1,6 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -fpic" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 extern void abort (void);
 extern void exit (int);
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20020122-4.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020122-4.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20020122-4.c	Fri Mar 15 06:36:37 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020122-4.c	Sat Nov  5 19:17:25 2005
@@ -2,7 +2,7 @@
    (mem (lo_sum pic (symbol_ref))) within an asm at the right time.  */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fpic" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 void foo()
 {
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20020219-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020219-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20020219-1.c	Tue Oct 15 00:07:18 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020219-1.c	Sat Nov  5 19:17:25 2005
@@ -8,6 +8,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2" } */
 /* { dg-options "-O2 -mdisable-indexing" { target hppa*-*-hpux* } } */
+/* { dg-options "-mshort" { target m6811-*-* m6812-*-* } } */
 
 /* Disable the test entirely for 16-bit targets.  */
 #if __INT_MAX__ > 32767
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20020415-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020415-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20020415-1.c	Mon Apr 22 03:19:05 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020415-1.c	Sat Nov  5 19:17:25 2005
@@ -3,7 +3,7 @@
    ASM_SIMPLIFY_DWARF_ADDR hook.  */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fpic -g" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 static inline char *
 bar (unsigned long x, char *y)
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20020426-2.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020426-2.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20020426-2.c	Sun Apr 28 21:48:10 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020426-2.c	Sat Nov  5 19:17:25 2005
@@ -3,6 +3,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2" } */
 /* { dg-options "-O2 -frename-registers -fomit-frame-pointer -fPIC -mcpu=i686" { target i?86-*-* } } */
+/* { dg-warning "not supported" "PIC unsupported" { target m6811-*-* m6812-*-* } 0 } */
 
 typedef struct
 {
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20020430-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020430-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20020430-1.c	Fri Feb  7 05:00:04 2003
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20020430-1.c	Sat Nov  5 19:17:25 2005
@@ -6,6 +6,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-O2 -frename-registers -fpic" } */
+/* { dg-warning "not supported" "PIC unsupported" { target m6811-*-* m6812-*-* } 0 } */
 
 typedef unsigned long XID;
 typedef XID Window;
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20021014-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021014-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20021014-1.c	Mon Oct 28 19:10:56 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021014-1.c	Sat Nov  5 19:17:25 2005
@@ -9,6 +9,7 @@
 /* Support for -p on irix relies on libprof1.a which doesn't appear to
    exist on any irix6 system currently posting testsuite results.  */
 /* { dg-error "libprof1.a" "Profiler support missing" { target mips*-*-irix* } 0 } */
+/* { dg-error "mcount" "Profiler support missing" { target m6811-*-* m6812-*-* } 0 } */
 
 extern void abort (void);
 extern void exit (int);
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20021018-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021018-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20021018-1.c	Mon Oct 21 22:27:14 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021018-1.c	Sat Nov  5 19:17:25 2005
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -fpic" } */
+/* { dg-warning "not supported" "PIC unsupported" { target m6811-*-* m6812-*-* } 0 } */
 
 extern void abort (void);
 extern void exit (int);
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20021023-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021023-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20021023-1.c	Wed Oct 23 23:20:08 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021023-1.c	Sat Nov  5 19:17:25 2005
@@ -2,6 +2,7 @@
    considered as local_symbolic_operand.  */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fpic" } */
+/* { dg-warning "not supported" "PIC unsupported" { target m6811-*-* m6812-*-* } 0 } */
 
 typedef __builtin_va_list va_list;
 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20021029-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021029-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20021029-1.c	Thu Nov 14 08:56:54 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021029-1.c	Sat Nov  5 19:17:25 2005
@@ -2,6 +2,7 @@
    variables into writable sections.  */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fpic" } */
+/* { dg-warning "not supported" "PIC unsupported" { target m6811-*-* m6812-*-* } 0 } */
 /* { dg-final { scan-assembler-not ".data.rel.ro.local" } } */
 
 int foo (int a)
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20021116-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021116-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20021116-1.c	Sat Nov 16 21:04:40 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20021116-1.c	Sat Nov  5 19:17:25 2005
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fpic" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 void **
 foo (void **x, int y, void *z)
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20030120-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20030120-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20030120-1.c	Tue Jan 21 08:40:04 2003
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20030120-1.c	Sat Nov  5 19:17:25 2005
@@ -1,7 +1,7 @@
 /* PR 7154 */
 /* { dg-do compile } */
 /* { dg-options "-O -fpic" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 const int x[1]={ 1 };
 void foo(int i, int *p)
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20030213-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20030213-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20030213-1.c	Fri Feb 14 10:21:30 2003
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20030213-1.c	Sat Nov  5 19:17:25 2005
@@ -1,7 +1,7 @@
 /* Testcase for http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01017.html */
 /* { dg-do link } */
 /* { dg-options "-O -fpic" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 int *g;
 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/20030225-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20030225-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/20030225-1.c	Wed Feb 26 00:20:14 2003
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/20030225-1.c	Sat Nov  5 19:17:25 2005
@@ -5,7 +5,7 @@
    and Benjamin Herrenschmidt <benh@kernel.crashing.org>.  */
 /* { dg-do run } */
 /* { dg-options "-O2 -fPIC" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 
 extern void exit (int);
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/inline-2.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/inline-2.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/inline-2.c	Wed Oct  2 10:26:39 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/inline-2.c	Sat Nov  5 19:17:25 2005
@@ -2,7 +2,7 @@
    it has been deferred.  */
 /* { dg-do compile } */
 /* { dg-options "-O3 -finline-limit=0 -fpic" } */
-/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* } 0 } */
+/* { dg-warning "not supported" "PIC unsupported" { target cris-*-elf* cris-*-aout* mmix-*-* m6811-*-* m6812-*-* } 0 } */
 
 static int foo(void)
 {
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/nest.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/nest.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/nest.c	Sat Aug  9 08:51:11 2003
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/nest.c	Sat Nov  5 19:17:25 2005
@@ -5,6 +5,7 @@
 /* Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
    See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html */
 /* { dg-error "gcrt1.o" "Profiler support missing" { target mips*-*-irix* } 0 } */
+/* { dg-error "mcount" "Profiler support missing" { target m6811-*-* m6812-*-* } 0 } */
 /* { dg-error "-pg not supported" "Profiler support missing" { target *-*-sco3.2v5* } 0 } */
 
 long foo (long x)
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.dg/noncompile/20020213-1.c gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/noncompile/20020213-1.c
--- gcc-3.3.6/gcc/testsuite/gcc.dg/noncompile/20020213-1.c	Thu Feb 14 11:22:53 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.dg/noncompile/20020213-1.c	Sat Nov  5 19:17:25 2005
@@ -3,8 +3,8 @@
 typedef struct { int i; } FILE;
 typedef __SIZE_TYPE__ size_t;
 int fputs (const char *, FILE *);
-void bzero (void *, size_t);
-int bcmp (const void *, const void *, size_t);
+void bzero (void *, size_t); /* { dg-warning "conflicting types for built-in" { target m6811-*-* } } */
+int bcmp (const void *, const void *, size_t); /* { dg-warning "conflicting types for built-in" { target m6811-*-* } } */
 
 char buf[32];
 FILE *f;
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/testsuite/gcc.misc-tests/bprob.exp gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.misc-tests/bprob.exp
--- gcc-3.3.6/gcc/testsuite/gcc.misc-tests/bprob.exp	Mon Oct 21 22:21:00 2002
+++ gcc-3.3.6-m68hc1x/gcc/testsuite/gcc.misc-tests/bprob.exp	Sat Nov  5 19:17:25 2005
@@ -1,4 +1,4 @@
-#   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+#   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,7 +20,9 @@
 # Some targets don't have any implementation of __bb_init_func or are
 # missing other needed machinery.
 if { [istarget mmix-*-*]
-     || [istarget cris-*-*] } {
+     || [istarget cris-*-*]
+     || [istarget m6811-*-*]
+     || [istarget m6812-*-*] } {
     return
 }
 
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/toplev.c gcc-3.3.6-m68hc1x/gcc/toplev.c
--- gcc-3.3.6/gcc/toplev.c	Fri Mar  5 18:55:51 2004
+++ gcc-3.3.6-m68hc1x/gcc/toplev.c	Sat Nov  5 19:17:25 2005
@@ -3101,7 +3101,10 @@ rest_of_compilation (decl)
 	setjmp_args_warning ();
     }
 
-  if (optimize)
+  /* SCz: PR target/5854, this is initializing registers by inserting
+     instructions before the prologue instructions that save incomming
+     registers.  */
+  if (optimize && 0)
     {
       if (!flag_new_regalloc && initialize_uninitialized_subregs ())
 	{
diff --exclude-from=exclude.lst -Nrup gcc-3.3.6/gcc/version.c gcc-3.3.6-m68hc1x/gcc/version.c
--- gcc-3.3.6/gcc/version.c	Tue May  3 12:56:18 2005
+++ gcc-3.3.6-m68hc1x/gcc/version.c	Sun Jan 22 21:17:06 2006
@@ -6,7 +6,7 @@
    please modify this string to indicate that, e.g. by putting your
    organization's name in parentheses at the end of the string.  */
 
-const char version_string[] = "3.3.6";
+const char version_string[] = "3.3.6-m68hc1x-20060122";
 
 /* This is the location of the online document giving instructions for
    reporting bugs.  If you distribute a modified version of GCC,