Quick Search:

Mode

Context

Displaying the whole file. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.50
 
1.51
 
MAIN:ragge:20130216170014
 
table.c
_>11 /*      $Id$    */
 22 /*
 33  * Copyright (c) 2008 Michael Shalayeff
 44  * Copyright (c) 2008 Anders Magnusson (ragge@ludd.ltu.se).
 55  * All rights reserved.
 66  *
 77  * Redistribution and use in source and binary forms, with or without
 88  * modification, are permitted provided that the following conditions
 99  * are met:
 1010  * 1. Redistributions of source code must retain the above copyright
 1111  *    notice, this list of conditions and the following disclaimer.
 1212  * 2. Redistributions in binary form must reproduce the above copyright
 1313  *    notice, this list of conditions and the following disclaimer in the
 1414  *    documentation and/or other materials provided with the distribution.
 1515  * 3. The name of the author may not be used to endorse or promote products
 1616  *    derived from this software without specific prior written permission
 1717  *
 1818  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 1919  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 2020  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 2121  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 2222  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 2323  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 2424  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 2525  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 2626  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 2727  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 2828  */
 2929 
 3030 
 3131 # include "pass2.h"
 3232 
 3333 #define TLL TLONG|TULONG
 3434 # define ANYSIGNED TINT|TSHORT|TCHAR
 3535 # define ANYUSIGNED TUNSIGNED|TUSHORT|TUCHAR
 3636 # define ANYFIXED ANYSIGNED|ANYUSIGNED
 3737 # define TUWORD TUNSIGNED
 3838 # define TSWORD TINT
 3939 # define TWORD  TUWORD|TSWORD
 4040 #define TANYINT TLL|ANYFIXED
 4141 #define  SHINT  SAREG   /* Any integer */
 4242 #define  ININT  INAREG
 4343 #define  SHFL   SCREG   /* shape for long double */
 4444 #define  INFL   INCREG  /* shape for long double */
 4545 
 4646 struct optab table[] = {
 4747 /* First entry must be an empty entry */
 4848 { -1, FOREFF, SANY, TANY, SANY, TANY, 0, 0, "", },
 4949 
 5050 /* PCONVs are usually not necessary */
 5151 { PCONV,        INAREG,
 5252         SAREG,  TLL|TPOINT,
 5353         SAREG,  TLL|TPOINT,
 5454                 0,      RLEFT,
 5555                 "", },
 5656 
 5757 { PCONV,        INAREG,
 5858         SAREG|SOREG|SNAME,      TWORD,
 5959         SAREG,  TPOINT,
 6060                 NASL|NAREG,     RESC1,
 6161                 "       movl AL,Z1\n", },/* amd64 zero-extends 32-bit movl */
 6262         
 6363 
 6464 /*
 6565  * On amd64 casts from larger to smaller integer type in register do nothing.
 6666  */
 6767 /* 64-bit to smaller */
 6868 { SCONV,        INAREG,
 6969         SAREG,  TLL|TPOINT,
 7070         SAREG,  TANYINT,
 7171                 0,      RLEFT,
 7272                 "", },
 7373 
 7474 /* 32-bit to smaller */
 7575 { SCONV,        INAREG,
 7676         SAREG,  TWORD,
 7777         SAREG,  ANYFIXED,
 7878                 0,      RLEFT,
 7979                 "", },
 8080 
 8181 /* 16-bit to smaller */
 8282 { SCONV,        INAREG,
 8383         SAREG,  TSHORT|TUSHORT,
 8484         SAREG,  TUSHORT|TUCHAR|TSHORT|TCHAR,
 8585                 0,      RLEFT,
 8686                 "", },
 8787 
 8888 /* 8-bit to 8-bit */
 8989 { SCONV,        INAREG,
 9090         SAREG,  TCHAR|TUCHAR,
 9191         SAREG,  TUCHAR|TCHAR,
 9292                 0,      RLEFT,
 9393                 "", },
 9494 
 9595 /*
 9696  * Casts from memory to same or smaller register is equally simple.
 9797  */
 9898 /* 64-bit to smaller */
 9999 { SCONV,        INAREG,
 100100         SNAME|SOREG,    TLL|TPOINT,
 101101         SAREG,          TANYINT,
 102102                 NAREG,  RESC1,
 103103                 "       movZR AL,A1\n", },
 104104 
 105105 /* 32-bit to smaller */
 106106 { SCONV,        INAREG,
 107107         SNAME|SOREG,    TWORD,
 108108         SAREG,          ANYFIXED,
 109109                 NAREG,  RESC1,
 110110                 "       movZR AL,A1\n", },
 111111 
 112112 /* 16-bit to smaller */
 113113 { SCONV,        INAREG,
 114114         SNAME|SOREG,    TSHORT|TUSHORT,
 115115         SAREG,          TUSHORT|TUCHAR|TSHORT|TCHAR,
 116116                 NAREG,  RESC1,
 117117                 "       movZR AL,A1\n", },
 118118 
 119119 /* 8-bit to 8-bit */
 120120 { SCONV,        INAREG,
 121121         SNAME|SOREG,    TCHAR|TUCHAR,
 122122         SAREG,          TUCHAR|TCHAR,
 123123                 NAREG,  RESC1,
 124124                 "       movZR AL,A1\n", },
 125125 
 126126 
 127127 /* char to something */
 128128 
 129129 /* convert char to (unsigned) short. */
 130130 { SCONV,        ININT,
 131131         SAREG|SOREG|SNAME,      TCHAR,
 132132         SAREG,  TSHORT|TUSHORT,
 133133                 NASL|NAREG,     RESC1,
 134134                 "       movsbw AL,A1\n", },
 135135 
 136136 /* convert unsigned char to (u)short. */
 137137 { SCONV,        ININT,
 138138         SAREG|SOREG|SNAME,      TUCHAR,
 139139         SAREG,  TSHORT|TUSHORT,
 140140                 NASL|NAREG,     RESC1,
 141141                 "       movzbw AL,A1\n", },
 142142 
 143143 /* convert signed char to int (or pointer). */
 144144 { SCONV,        ININT,
 145145         SAREG|SOREG|SNAME,      TCHAR,
 146146         SAREG,  TWORD|TPOINT,
 147147                 NASL|NAREG,     RESC1,
 148148                 "       movsbl AL,A1\n", },
 149149 
 150150 /* convert unsigned char to (u)int. */
 151151 { SCONV,        ININT,
 152152         SAREG|SOREG|SNAME,      TUCHAR,
 153153         SAREG,  TWORD,
 154154                 NASL|NAREG,     RESC1,
 155155                 "       movzbl AL,A1\n", },
 156156 
 157157 /* convert char to (u)long long */
 158158 { SCONV,        INAREG,
 159159         SAREG|SOREG|SNAME,      TCHAR,
 160160         SANY,   TLL,
 161161                 NAREG|NASL,     RESC1,
 162162                 "       movsbq AL,A1\n", },
 163163 
 164164 /* convert unsigned char to (u)long long */
 165165 { SCONV,        INAREG,
 166166         SAREG|SOREG|SNAME,      TUCHAR,
 167167         SANY,                   TLL,
 168168                 NAREG|NASL,     RESC1,
 169169                 "       movzbq AL,A1\n", },
 170170 
 171171 /* short to something */
 172172 
 173173 /* convert short to (u)int. */
 174174 { SCONV,        ININT,
 175175         SAREG|SOREG|SNAME,      TSHORT,
 176176         SAREG,  TWORD,
 177177                 NASL|NAREG,     RESC1,
 178178                 "       movswl AL,A1\n", },
 179179 
 180180 /* convert unsigned short to (u)int. */
 181181 { SCONV,        ININT,
 182182         SAREG|SOREG|SNAME,      TUSHORT,
 183183         SAREG,  TWORD,
 184184                 NASL|NAREG,     RESC1,
 185185                 "       movzwl AL,A1\n", },
 186186 
 187187 /* convert short to (u)long long */
 188188 { SCONV,        INAREG,
 189189         SAREG|SOREG|SNAME,      TSHORT,
 190190         SAREG,                  TLL,
 191191                 NAREG|NASL,     RESC1,
 192192                 "       movswq AL,A1\n", },
 193193 
 194194 /* convert unsigned short to (u)long long */
 195195 { SCONV,        INAREG,
 196196         SAREG|SOREG|SNAME,      TUSHORT,
 197197         SAREG,                  TLL,
 198198                 NAREG|NASL,     RESC1,
 199199                 "       movzwq AL,A1\n", },
 200200 
 201201 /* int to something */
 202202 
 203203 /* convert signed int to (u)long long */
 204204 { SCONV,        INAREG,
 205205         SAREG,  TSWORD,
 206206         SAREG,  TLL,
 207207                 NASL|NAREG,     RESC1,
 208208                 "       movslq AL,A1\n", },
 209209 
 210210 /* convert unsigned int to (u)long long */
 211211 { SCONV,        INAREG,
 212212         SAREG|SOREG|SNAME,      TUWORD,
 213213         SAREG,  TLL,
 214214                 NASL|NAREG,     RESC1,
 215215                 "       movl AL,Z1\n", },/* amd64 zero-extends 32-bit movl */
 216216 
 217217 /*
 218218  * Floating point casts.  amd64 uses xmm for float/double and x87
 219219  * for long double calculations.
 220220  *
 221221  * Types smaller than int are casted to int/(unsigned).
 222222  */
 223223 /* no casts */
 224224 { SCONV,        INBREG,
 225225         SBREG,  TFLOAT,
 226226         SBREG,  TFLOAT,
 227227                 0,      RLEFT,
 228228                 "", },
 229229 
 230230 { SCONV,        INBREG,
 231231         SBREG,  TDOUBLE,
 232232         SBREG,  TDOUBLE,
 233233                 0,      RLEFT,
 234234                 "", },
 235235 
 236236 { SCONV,        INCREG,
 237237         SCREG,  TLDOUBLE,
 238238         SCREG,  TLDOUBLE,
 239239                 0,      RLEFT,
 240240                 "", },
 241241 
 242242 
 243243 /* convert int/long to float/double */
 244244 { SCONV,        INBREG,
 245245         SAREG|SOREG|SNAME,      TINT|TLONG,
 246246         SBREG,                  TFLOAT|TDOUBLE,
 247247                 NBREG,  RESC1,
 248248                 "       cvtsi2sZfZq AL,A1\n", },
 249249 
 250250 /* convert unsigned int to float/double */
 251251 { SCONV,        INBREG,
 252252         SAREG|SOREG|SNAME,      TUNSIGNED,
 253253         SBREG,                  TFLOAT|TDOUBLE,
 254254                 NAREG|NBREG,    RESC2,
 255255                 "       movl AL,Z1\n    cvtsi2sZfq A1,A2\n", },
 256256 
 257257 /* convert unsigned long to float/double */
 258258 { SCONV,        INBREG,
 259259         SAREG|SOREG|SNAME,      TULONG,
 260260         SBREG,                  TFLOAT|TDOUBLE,
 261261                 NAREG*2|NASL|NBREG,     RESC3,
 262262                 "Zj", },
 263263 
 264264 /* convert float/double to (u)char/(u)short/int */
 265265 { SCONV,        INAREG,
 266266         SBREG|SOREG|SNAME,      TFLOAT|TDOUBLE,
 267267         SAREG,                  TCHAR|TUCHAR|TSHORT|TUSHORT|INT,
 268268                 NAREG,          RESC1,
 269269                 "       cvttsZg2si AL,A1\n", },
 270270 
 271271 /* convert float/double to  unsigned int/long */
 272272 { SCONV,        INAREG,
 273273         SBREG|SOREG|SNAME,      TFLOAT|TDOUBLE,
 274274         SAREG,                  TUNSIGNED|TLONG,
 275275                 NAREG,          RESC1,
 276276                 "       cvttsZg2siq AL,Z8\n", },
 277277 
 278278 /* convert float to double */
 279279 { SCONV,        INBREG,
 280280         SBREG|SNAME|SOREG,      TFLOAT,
 281281         SBREG,  TDOUBLE,
 282282                 NBREG|NBSL,     RESC1,
 283283                 "       cvtss2sd AL,A1\n", },
 284284 
 285285 /* convert double to float */
 286286 { SCONV,        INBREG,
 287287         SBREG|SNAME|SOREG,      TDOUBLE,
 288288         SBREG,  TFLOAT,
 289289                 NBREG|NBSL,     RESC1,
 290290                 "       cvtsd2ss AL,A1\n", },
 291291 
 292292 /* x87 conversions */
 293293 /* float -> ldouble */
 294294 { SCONV,        INCREG,
 295295         SBREG,  TFLOAT,
 296296         SCREG,  TLDOUBLE,
 297297                 NCREG,          RESC1,
 298298                 "\tsubq $4,%rsp\n\tmovss AL,(%rsp)\n"
 299299                 "\tflds (%rsp)\n\taddq $4,%rsp\n", },
 300300 
 301301 /* double -> ldouble */
 302302 { SCONV,        INCREG,
 303303         SBREG,  TDOUBLE,
 304304         SCREG,  TLDOUBLE,
 305305                 NCREG,          RESC1,
 306306                 "\tsubq $8,%rsp\n\tmovsd AL,(%rsp)\n"
 307307                 "\tfldl (%rsp)\n\taddq $8,%rsp\n", },
 308308 
 309309 /* ldouble -> double */
 310310 { SCONV,        INBREG,
 311311         SCREG,  TLDOUBLE,
 312312         SBREG,  TDOUBLE,
 313313                 NBREG,          RESC1,
 314314                 "\tsubq $8,%rsp\n\tfstpl (%rsp)\n"
 315315                 "\tmovsd (%rsp),A1\n\taddq $8,%rsp\n", },
 316316 
 317317 /* ldouble -> float */
 318318 { SCONV,        INBREG,
 319319         SCREG,  TLDOUBLE,
 320320         SBREG,  TFLOAT,
 321321                 NBREG,          RESC1,
 322322                 "\tsubq $4,%rsp\n\tfstps (%rsp)\n"
 323323                 "\tmovss (%rsp),A1\n\taddq $4,%rsp\n", },
 324324 
 325325 /* convert int (in memory) to long double */
 326326 { SCONV,        INCREG,
 327327         SOREG|SNAME,    TSWORD,
 328328         SCREG,   TLDOUBLE,
 329329                 NCREG,  RESC1,
 330330                 "       fildl AL\n", },
 331331 
 332332 /* convert unsigned int to long double */
 333333 { SCONV,        INCREG,
 334334         SAREG,  TUWORD,
 335335         SCREG,  TLDOUBLE,
 336336                 NAREG|NASL|NCREG,       RESC2,
 337337                 "       subq $16,%rsp\n"
 338338                 "       movl AL,Z1\n"
 339339                 "       movq A1,(%rsp)\n"
 340340                 "       fildll (%rsp)\n"
 341341                 "       addq $16,%rsp\n", },
 342342 
 343343 /* convert int (in register) to long double */
 344344 { SCONV,        INCREG,
 345345         SAREG,  TSWORD,
 346346         SCREG,  TLDOUBLE,
 347347                 NCREG,  RESC1,
 348348                 "       subq $4,%rsp\n"
 349349                 "       movl AL,(%rsp)\n"
 350350                 "       fildl (%rsp)\n"
 351351                 "       addq $4,%rsp\n", },
 352352 
 353353 /* unsigned long (in reg) to long double */
 354354 { SCONV,        INCREG,
 355355         SAREG,          TULONG,
 356356         SCREG,          TLDOUBLE,
 357357                 NCREG,  RESC1,
 358358                 "       subq $16,%rsp\n"
 359359                 "       movq AL,(%rsp)\n"
 360360                 "       fildll (%rsp)\n"
 361361                 "       cmpq $0,AL\n"
 362362                 "       jns 1f\n"
 363363                 "       movl $1602224128,(%rsp)\n"
 364364                 "       fadds (%rsp)\n"
 365365                 "       addq $16,%rsp\n"
 366366                 "1:\n", },
 367367 
 368368 /* unsigned long (in mem) to long double */
 369369 { SCONV,        INCREG,
 370370         SNAME|SOREG,    TULONG,
 371371         SCREG,          TLDOUBLE,
 372372                 NCREG,  RESC1,
 373373                 "       fildll AL\n"
 374374                 "       cmpq $0,AL\n"
 375375                 "       jns 1f\n"
 376376                 "       push $1602224128\n"
 377377                 "       fadds (%rsp)\n"
 378378                 "       addq $8,%rsp\n"
 379379                 "1:\n", },
 380380 
 381381 /* convert float/double to  unsigned long */
 382382 { SCONV,        INAREG,
 383383         SBREG,          TFLOAT|TDOUBLE,
 384384         SAREG,          TULONG,
 385385                 (NAREG*2)|NBREG,        RESC1,
 386386                 "Zb\n", },
 387387 
 388388 /* long double to unsigned long */
 389389 { SCONV,        INAREG,
 390390         SCREG|SNAME|SOREG,      TLDOUBLE,
 391391         SAREG,                  TULONG,
 392392                 NAREG,  RESC1,
 393393                 "ZB", },
 394394 
 395395 /* ldouble -> long  XXX merge with int */
 396396 { SCONV,        INAREG,
 397397         SCREG,  TLDOUBLE,
 398398         SAREG,  TLONG,
 399399                 NAREG,  RESC1,
 400400                 "       subq $16,%rsp\n"
 401401                 "       fnstcw (%rsp)\n"
 402402                 "       fnstcw 4(%rsp)\n"
 403403                 "       movb $12,1(%rsp)\n"
 404404                 "       fldcw (%rsp)\n"
 405405                 "       fistpll 8(%rsp)\n"
 406406                 "       movq 8(%rsp),A1\n"
 407407                 "       fldcw 4(%rsp)\n"
 408408                 "       addq $16,%rsp\n", },
 409409 
 410410 /* ldouble -> (u)int */
 411411 { SCONV,        INAREG,
 412412         SCREG,  TLDOUBLE,
 413413         SAREG,  TINT|TUNSIGNED,
 414414                 NAREG,  RESC1,
 415415                 "       subq $16,%rsp\n"
 416416                 "       fnstcw (%rsp)\n"
 417417                 "       fnstcw 4(%rsp)\n"
 418418                 "       movb $12,1(%rsp)\n"
 419419                 "       fldcw (%rsp)\n"
 420420                 "       fistpq 8(%rsp)\n"
 421421                 "       movl 8(%rsp),A1\n"
 422422                 "       fldcw 4(%rsp)\n"
 423423                 "       addq $16,%rsp\n", },
 424424 
 425425 /* long (in mem) -> ldouble */
 426426 { SCONV,        INCREG,
 427427         SNAME|SOREG,    TLONG,
 428428         SCREG,          TLDOUBLE,
 429429                 NCREG,  RESC1,
 430430                 "       fildll AL\n", },
 431431 
 432432 /* long (in reg) -> ldouble */
 433433 { SCONV,        INCREG,
 434434         SAREG,          TLONG,
 435435         SCREG,          TLDOUBLE,
 436436                 NCREG,  RESC1,
 437437                 "       subq $16,%rsp\n"
 438438                 "       movq AL,(%rsp)\n"
 439439                 "       fildll (%rsp)\n"
 440440                 "       addq $16,%rsp\n", },
 441441 
 442442 
 443443 
 444444 /* slut sconv */
 445445 
 446446 /*
 447447  * Subroutine calls.
 448448  */
 449449 
 450450 { CALL,         FOREFF,
 451451         SCON,   TANY,
 452452         SANY,   TANY,
 453453                 0,      0,
 454454                 "       call CL\nZC", },
 455455 
 456456 { UCALL,        FOREFF,
 457457         SCON,   TANY,
 458458         SANY,   TANY,
 459459                 0,      0,
 460460                 "       call CL\n", },
 461461 
 462462 { CALLINAREG,
 463463         SCON,   TANY,
 464464         SAREG,  TLL|ANYFIXED|TPOINT,
 465465                 NAREG|NASL,     RESC1,  /* should be 0 */
 466466                 "       call CL\nZC", },
 467467 
 468468 { UCALL,        INAREG,
 469469         SCON,   TANY,
 470470         SAREG,  TLL|ANYFIXED|TPOINT,
 471471                 NAREG|NASL,     RESC1,  /* should be 0 */
 472472                 "       call CL\n", },
 473473 
 474474 { CALLINBREG,
 475475         SCON,   TANY,
 476476         SBREG,  TANY,
 477477                 NBREG|NBSL,     RESC1,  /* should be 0 */
 478478                 "       call CL\nZC", },
 479479 
 480480 { UCALL,        INBREG,
 481481         SCON,   TANY,
 482482         SBREG,  TANY,
 483483                 NBREG|NBSL,     RESC1,  /* should be 0 */
 484484                 "       call CL\nZC", },
 485485 
 486486 { CALL, INCREG,
 487487         SCON,   TANY,
 488488         SCREG,  TANY,
 489489                 NCREG|NCSL,     RESC1,  /* should be 0 */
 490490                 "       call CL\nZC", },
 491491 
 492492 { UCALL,        INCREG,
 493493         SCON,   TANY,
 494494         SCREG,  TANY,
 495495                 NCREG|NCSL,     RESC1,  /* should be 0 */
 496496                 "       call CL\nZC", },
 497497 
 498498 
 499499 { CALL,         FOREFF,
 500500         SAREG,  TANY,
 501501         SANY,   TANY,
 502502                 0,      0,
 503503                 "       call *AL\nZC", },
 504504 
 505505 { UCALL,        FOREFF,
 506506         SAREG,  TANY,
 507507         SANY,   TANY,
 508508                 0,      0,
 509509                 "       call *AL\nZC", },
 510510 
 511511 { CALL,         INAREG,
 512512         SAREG,  TANY,
 513513         SANY,   TANY,
 514514                 NAREG|NASL,     RESC1,  /* should be 0 */
 515515                 "       call *AL\nZC", },
 516516 
 517517 { UCALL,        INAREG,
 518518         SAREG,  TANY,
 519519         SANY,   TANY,
 520520                 NAREG|NASL,     RESC1,  /* should be 0 */
 521521                 "       call *AL\nZC", },
 522522 
 523523 { CALL,         INBREG,
 524524         SAREG,  TANY,
 525525         SANY,   TANY,
 526526                 NBREG|NBSL,     RESC1,  /* should be 0 */
 527527                 "       call *AL\nZC", },
 528528 
 529529 { UCALL,        INBREG,
 530530         SAREG,  TANY,
 531531         SANY,   TANY,
 532532                 NBREG|NBSL,     RESC1,  /* should be 0 */
 533533                 "       call *AL\nZC", },
 534534 
 535535 { CALL,         INCREG,
 536536         SAREG,  TANY,
 537537         SANY,   TANY,
 538538                 NCREG|NCSL,     RESC1,  /* should be 0 */
 539539                 "       call *AL\nZC", },
 540540 
 541541 { UCALL,        INCREG,
 542542         SAREG,  TANY,
 543543         SANY,   TANY,
 544544                 NCREG|NCSL,     RESC1,  /* should be 0 */
 545545                 "       call *AL\nZC", },
 546546 
 547547 /* struct return */
 548548 { USTCALL,      FOREFF,
 549549         SCON,   TANY,
 550550         SANY,   TANY,
 551551                 NAREG|NASL,     0,
 552552                 "ZP     call CL\nZC", },
 553553 
 554554 { USTCALL,      INAREG,
 555555         SCON,   TANY,
 556556         SANY,   TANY,
 557557                 NAREG|NASL,     RESC1,  /* should be 0 */
 558558                 "ZP     call CL\nZC", },
 559559 
 560560 { USTCALL,      INAREG,
 561561         SNAME|SAREG,    TANY,
 562562         SANY,   TANY,
 563563                 NAREG|NASL,     RESC1,  /* should be 0 */
 564564                 "ZP     call *AL\nZC", },
 565565 
 566566 { STCALL,       FOREFF,
 567567         SCON,   TANY,
 568568         SANY,   TANY,
 569569                 NAREG|NASL,     0,
 570570                 "ZP     call CL\nZC", },
 571571 
 572572 { STCALL,       INAREG,
 573573         SCON,   TANY,
 574574         SANY,   TANY,
 575575                 NAREG|NASL,     RESC1,  /* should be 0 */
 576576                 "ZP     call CL\nZC", },
 577577 
 578578 { STCALL,       FOREFF,
 579579         SNAME|SAREG,    TANY,
 580580         SANY,   TANY,
 581581                 NAREG|NASL,     0,      /* should be 0 */
 582582                 "ZP     call *AL\nZC", },
 583583 
 584584 { STCALL,       INAREG,
 585585         SNAME|SAREG,    TANY,
 586586         SANY,   TANY,
 587587                 NAREG|NASL,     RESC1,  /* should be 0 */
 588588                 "ZP     call *AL\nZC", },
 589589 
 590590 /*
 591591  * The next rules handle all binop-style operators.
 592592  */
 593593 /* floating point add */
 594594 { PLUS,         INBREG,
 595595         SBREG,                  TFLOAT|TDOUBLE,
 596596         SBREG|SNAME|SOREG,      TFLOAT|TDOUBLE,
 597597                 0,      RLEFT,
 598598                 "       addsZf AR,AL\n", },
 599599 
 600600 { PLUS,         INCREG|FOREFF,
 601601         SHFL,   TLDOUBLE,
 602602         SHFL,   TLDOUBLE,
 603603                 0,      RLEFT,
 604604                 "       faddp\n", },
 605605 
 606606 
 607607 { PLUS,         INAREG|FOREFF,
 608608         SAREG|SNAME|SOREG,      TLL|TPOINT,
 609609         SONE,   TANY,
 610610                 0,      RLEFT,
 611611                 "       incq AL\n", },
 612612 
 613613 { PLUS,         INAREG|FOREFF,
 614614         SAREG|SNAME|SOREG,      TWORD,
 615615         SONE,   TANY,
 616616                 0,      RLEFT,
 617617                 "       incl AL\n", },
 618618 
 619619 { PLUS,         INAREG,
 620620         SAREG,  TLL|TPOINT,
 621621         SCON,   TWORD,
 622622                 NAREG|NASL,     RESC1,
 623623                 "       leaq CR(AL),A1\n", },
 624624 
 625625 #ifdef notdef
 626626 /* older binutils are missing leal */
 627627 { PLUS,         INAREG,
 628628         SAREG,  TWORD,
 629629         SCON,   TANY,
 630630                 NAREG|NASL,     RESC1,
 631631                 "       leal CR(AL),A1\n", },
 632632 #endif
 633633 
 634634 { PLUS,         INAREG|FOREFF,
 635635         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
 636636         SONE,   TANY,
 637637                 0,      RLEFT,
 638638                 "       incw AL\n", },
 639639 
 640640 { PLUS,         INAREG|FOREFF,
 641641         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 642642         SONE,   TANY,
 643643                 0,      RLEFT,
 644644                 "       incb AL\n", },
 645645 
 646646 #ifdef notdef
 647647 /* older binutils are missing leal */
 648648 { PLUS,         INAREG,
 649649         SAREG,  TWORD,
 650650         SAREG,  TWORD,
 651651                 NAREG|NASL|NASR,        RESC1,
 652652                 "       leal (AL,AR),A1\n", },
 653653 #endif
 654654 
 655655 { MINUS,        INAREG|FOREFF,
 656656         SAREG|SNAME|SOREG,      TLL|TPOINT,
 657657         SONE,                   TANY,
 658658                 0,      RLEFT,
 659659                 "       decq AL\n", },
 660660 
 661661 { MINUS,        INAREG|FOREFF,
 662662         SAREG|SNAME|SOREG,      TWORD,
 663663         SONE,                   TANY,
 664664                 0,      RLEFT,
 665665                 "       decl AL\n", },
 666666 
 667667 { MINUS,        INAREG|FOREFF,
 668668         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
 669669         SONE,                   TANY,
 670670                 0,      RLEFT,
 671671                 "       decw AL\n", },
 672672 
 673673 { MINUS,        INAREG|FOREFF,
 674674         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 675675         SONE,   TANY,
 676676                 0,      RLEFT,
 677677                 "       decb AL\n", },
 678678 
 679679 /* address as register offset, negative */
 680680 { MINUS,        INAREG,
 681681         SAREG,  TLL|TPOINT,
 682682         SPCON,  TANY,
 683683                 NAREG|NASL,     RESC1,
 684684                 "       leaq -CR(AL),A1\n", },
 685685 
 686686 { MINUS,        INBREG|FOREFF,
 687687         SBREG,                  TDOUBLE|TFLOAT,
 688688         SBREG|SNAME|SOREG,      TDOUBLE|TFLOAT,
 689689                 0,      RLEFT,
 690690                 "       subsZf AR,AL\n", },
 691691 
 692692 { MINUS,        INCREG|FOREFF,
 693693         SHFL,   TLDOUBLE,
 694694         SHFL,   TLDOUBLE,
 695695                 0,      RLEFT,
 696696                 "       fsubZAp\n", },
 697697 
 698698 /* Simple r/m->reg ops */
 699699 /* m/r |= r */
 700700 { OPSIMP,       INAREG|FOREFF|FORCC,
 701701         SAREG|SNAME|SOREG,      TLL|TPOINT,
 702702         SAREG,                  TLL|TPOINT,
 703703                 0,      RLEFT|RESCC,
 704704                 "       Oq AR,AL\n", },
 705705 
 706706 /* r |= r/m */
 707707 { OPSIMP,       INAREG|FOREFF|FORCC,
 708708         SAREG,                  TLL|TPOINT,
 709709         SAREG|SNAME|SOREG,      TLL|TPOINT,
 710710                 0,      RLEFT|RESCC,
 711711                 "       Oq AR,AL\n", },
 712712 
 713713 /* m/r |= r */
 714714 { OPSIMP,       INAREG|FOREFF|FORCC,
 715715         SAREG|SNAME|SOREG,      TWORD,
 716716         SAREG,                  TWORD,
 717717                 0,      RLEFT|RESCC,
 718718                 "       Ol AR,AL\n", },
 719719 
 720720 /* r |= r/m */
 721721 { OPSIMP,       INAREG|FOREFF|FORCC,
 722722         SAREG,                  TWORD,
 723723         SAREG|SNAME|SOREG,      TWORD,
 724724                 0,      RLEFT|RESCC,
 725725                 "       Ol AR,AL\n", },
 726726 
 727727 /* m/r |= r */
 728728 { OPSIMP,       INAREG|FOREFF|FORCC,
 729729         SHINT|SNAME|SOREG,      TSHORT|TUSHORT,
 730730         SHINT,          TSHORT|TUSHORT,
 731731                 0,      RLEFT|RESCC,
 732732                 "       Ow AR,AL\n", },
 733733 
 734734 /* r |= r/m */
 735735 { OPSIMP,       INAREG|FOREFF|FORCC,
 736736         SHINT,          TSHORT|TUSHORT,
 737737         SHINT|SNAME|SOREG,      TSHORT|TUSHORT,
 738738                 0,      RLEFT|RESCC,
 739739                 "       Ow AR,AL\n", },
 740740 
 741741 /* m/r |= r */
 742742 { OPSIMP,       INAREG|FOREFF|FORCC,
 743743         SAREG,          TCHAR|TUCHAR,
 744744         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 745745                 0,      RLEFT|RESCC,
 746746                 "       Ob AR,AL\n", },
 747747 
 748748 /* r |= r/m */
 749749 { OPSIMP,       INAREG|FOREFF|FORCC,
 750750         SAREG,          TCHAR|TUCHAR,
 751751         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 752752                 0,      RLEFT|RESCC,
 753753                 "       Ob AR,AL\n", },
 754754 
 755755 /* m/r |= const */
 756756 #ifdef notdef   /* amd64 lacks immediate 64-bit simple ops */
 757757 { OPSIMP,       INAREG|FOREFF|FORCC,
 758758         SAREG|SNAME|SOREG,      TLL|TPOINT,
 759759         SCON,   TANY,
 760760                 0,      RLEFT|RESCC,
 761761                 "       Oq AR,AL\n", },
 762762 #endif
 763763 
 764764 { OPSIMP,       INAREG|FOREFF|FORCC,
 765765         SAREG|SNAME|SOREG,      TWORD,
 766766         SCON,   TANY,
 767767                 0,      RLEFT|RESCC,
 768768                 "       Ol AR,AL\n", },
 769769 
 770770 { OPSIMP,       INAREG|FOREFF|FORCC,
 771771         SHINT|SNAME|SOREG,      TSHORT|TUSHORT,
 772772         SCON,   TANY,
 773773                 0,      RLEFT|RESCC,
 774774                 "       Ow AR,AL\n", },
 775775 
 776776 { OPSIMP,       INAREG|FOREFF|FORCC,
 777777         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 778778         SCON,   TANY,
 779779                 0,      RLEFT|RESCC,
 780780                 "       Ob AR,AL\n", },
 781781 
 782782 /*
 783783  * The next rules handle all shift operators.
 784784  */
 785785 /* r/m <<= r */
 786786 { LS,   INAREG|FOREFF,
 787787         SAREG|SNAME|SOREG,      TLL,
 788788         SAREG,          TCHAR|TUCHAR,
 789789                 NSPECIAL,       RLEFT,
 790790                 "       salq AR,AL\n", },
 791791 
 792792 /* r/m <<= const */
 793793 { LS,   INAREG|FOREFF,
 794794         SAREG|SNAME|SOREG,      TLL,
 795795         SCON,   TANY,
 796796                 0,      RLEFT,
 797797                 "       salq AR,AL\n", },
 798798 
 799799 /* r/m <<= r */
 800800 { LS,   INAREG|FOREFF,
 801801         SAREG|SNAME|SOREG,      TWORD,
 802802         SAREG,          TCHAR|TUCHAR,
 803803                 NSPECIAL,       RLEFT,
 804804                 "       sall AR,AL\n", },
 805805 
 806806 /* r/m <<= const */
 807807 { LS,   INAREG|FOREFF,
 808808         SAREG|SNAME|SOREG,      TWORD,
 809809         SCON,   TANY,
 810810                 0,      RLEFT,
 811811                 "       sall AR,AL\n", },
 812812 
 813813 /* r/m <<= r */
 814814 { LS,   INAREG|FOREFF,
 815815         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
 816816         SAREG,                  TCHAR|TUCHAR,
 817817                 NSPECIAL,       RLEFT,
 818818                 "       shlw AR,AL\n", },
 819819 
 820820 /* r/m <<= const */
 821821 { LS,   INAREG|FOREFF,
 822822         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
 823823         SCON,   TANY,
 824824                 0,      RLEFT,
 825825                 "       shlw AR,AL\n", },
 826826 
 827827 { LS,   INAREG|FOREFF,
 828828         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 829829         SAREG,                  TCHAR|TUCHAR,
 830830                 NSPECIAL,       RLEFT,
 831831                 "       salb AR,AL\n", },
 832832 
 833833 { LS,   INAREG|FOREFF,
 834834         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 835835         SCON,                   TANY,
 836836                 0,      RLEFT,
 837837                 "       salb AR,AL\n", },
 838838 
 839839 { RS,   INAREG|FOREFF,
 840840         SAREG|SNAME|SOREG,      TLONG|TLONGLONG,
 841841         SAREG,                  TCHAR|TUCHAR,
 842842                 NSPECIAL,       RLEFT,
 843843                 "       sarq AR,AL\n", },
 844844 
 845845 { RS,   INAREG|FOREFF,
 846846         SAREG|SNAME|SOREG,      TLONG|TLONGLONG,
 847847         SCON,                   TANY,
 848848                 0,              RLEFT,
 849849                 "       sarq AR,AL\n", },
 850850 
 851851 { RS,   INAREG|FOREFF,
 852852         SAREG|SNAME|SOREG,      TULONG|TULONGLONG,
 853853         SAREG,                  TCHAR|TUCHAR,
 854854                 NSPECIAL,       RLEFT,
 855855                 "       shrq AR,AL\n", },
 856856 
 857857 { RS,   INAREG|FOREFF,
 858858         SAREG|SNAME|SOREG,      TULONG|TULONGLONG,
 859859         SCON,                   TANY,
 860860                 0,              RLEFT,
 861861                 "       shrq AR,AL\n", },
 862862 
 863863 { RS,   INAREG|FOREFF,
 864864         SAREG|SNAME|SOREG,      TSWORD,
 865865         SAREG,                  TCHAR|TUCHAR,
 866866                 NSPECIAL,       RLEFT,
 867867                 "       sarl AR,AL\n", },
 868868 
 869869 { RS,   INAREG|FOREFF,
 870870         SAREG|SNAME|SOREG,      TSWORD,
 871871         SCON,                   TANY,
 872872                 0,              RLEFT,
 873873                 "       sarl AR,AL\n", },
 874874 
 875875 { RS,   INAREG|FOREFF,
 876876         SAREG|SNAME|SOREG,      TUWORD,
 877877         SAREG,                  TCHAR|TUCHAR,
 878878                 NSPECIAL,       RLEFT,
 879879                 "       shrl AR,AL\n", },
 880880 
 881881 { RS,   INAREG|FOREFF,
 882882         SAREG|SNAME|SOREG,      TUWORD,
 883883         SCON,                   TANY,
 884884                 0,              RLEFT,
 885885                 "       shrl AR,AL\n", },
 886886 
 887887 { RS,   INAREG|FOREFF,
 888888         SAREG|SNAME|SOREG,      TSHORT,
 889889         SAREG,                  TCHAR|TUCHAR,
 890890                 NSPECIAL,       RLEFT,
 891891                 "       sarw AR,AL\n", },
 892892 
 893893 { RS,   INAREG|FOREFF,
 894894         SAREG|SNAME|SOREG,      TSHORT,
 895895         SCON,                   TANY,
 896896                 0,              RLEFT,
 897897                 "       sarw AR,AL\n", },
 898898 
 899899 { RS,   INAREG|FOREFF,
 900900         SAREG|SNAME|SOREG,      TUSHORT,
 901901         SAREG,                  TCHAR|TUCHAR,
 902902                 NSPECIAL,       RLEFT,
 903903                 "       shrw AR,AL\n", },
 904904 
 905905 { RS,   INAREG|FOREFF,
 906906         SAREG|SNAME|SOREG,      TUSHORT,
 907907         SCON,                   TANY,
 908908                 0,              RLEFT,
 909909                 "       shrw AR,AL\n", },
 910910 
 911911 { RS,   INAREG|FOREFF,
 912912         SAREG|SNAME|SOREG,      TCHAR,
 913913         SAREG,                  TCHAR|TUCHAR,
 914914                 NSPECIAL,       RLEFT,
 915915                 "       sarb AR,AL\n", },
 916916 
 917917 { RS,   INAREG|FOREFF,
 918918         SAREG|SNAME|SOREG,      TCHAR,
 919919         SCON,                   TANY,
 920920                 0,              RLEFT,
 921921                 "       sarb AR,AL\n", },
 922922 
 923923 { RS,   INAREG|FOREFF,
 924924         SAREG|SNAME|SOREG,      TUCHAR,
 925925         SAREG,                  TCHAR|TUCHAR,
 926926                 NSPECIAL,       RLEFT,
 927927                 "       shrb AR,AL\n", },
 928928 
 929929 { RS,   INAREG|FOREFF,
 930930         SAREG|SNAME|SOREG,      TUCHAR,
 931931         SCON,                   TANY,
 932932                 0,              RLEFT,
 933933                 "       shrb AR,AL\n", },
 934934 
 935935 /*
 936936  * The next rules takes care of assignments. "=".
 937937  */
 938938 { ASSIGN,       FORCC|FOREFF|INAREG,
 939939         SAREG,          TLL|TPOINT,
 940940         SMIXOR,         TANY,
 941941                 0,      RDEST,
 942942                 "       xorq AL,AL\n", },
 943943 
 944944 { ASSIGN,       FOREFF|INAREG,
 945945         SAREG,          TLL|TPOINT,
 946946         SCON,           TANY,
 947947                 0,      RDEST,
 948948                 "       movabs AR,AL\n", },
 949949 
 950950 { ASSIGN,       FORCC|FOREFF|INAREG,
 951951         SAREG,          TWORD,
 952952         SMIXOR,         TANY,
 953953                 0,      RDEST,
 954954                 "       xorl AL,AL\n", },
 955955 
 956956 { ASSIGN,       FOREFF,
 957957         SAREG|SNAME|SOREG,      TWORD,
 958958         SCON,           TANY,
 959959                 0,      0,
 960960                 "       movl AR,AL\n", },
 961961 
 962962 { ASSIGN,       FOREFF|INAREG,
 963963         SAREG,  TWORD,
 964964         SCON,           TANY,
 965965                 0,      RDEST,
 966966                 "       movl AR,AL\n", },
 967967 
 968968 { ASSIGN,       FORCC|FOREFF|INAREG,
 969969         SAREG,  TSHORT|TUSHORT,
 970970         SMIXOR,         TANY,
 971971                 0,      RDEST,
 972972                 "       xorw AL,AL\n", },
 973973 
 974974 { ASSIGN,       FOREFF,
 975975         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
 976976         SCON,           TANY,
 977977                 0,      0,
 978978                 "       movw AR,AL\n", },
 979979 
 980980 { ASSIGN,       FOREFF|INAREG,
 981981         SAREG,  TSHORT|TUSHORT,
 982982         SCON,           TANY,
 983983                 0,      RDEST,
 984984                 "       movw AR,AL\n", },
 985985 
 986986 { ASSIGN,       FOREFF,
 987987         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 988988         SCON,           TANY,
 989989                 0,      0,
 990990                 "       movb AR,AL\n", },
 991991 
 992992 { ASSIGN,       FOREFF|INAREG,
 993993         SAREG,          TCHAR|TUCHAR,
 994994         SCON,           TANY,
 995995                 0,      RDEST,
 996996                 "       movb AR,AL\n", },
 997997 
 998998 { ASSIGN,       FOREFF|INAREG,
 999999         SAREG|SNAME|SOREG,      TLL|TPOINT,
 10001000         SAREG,                  TLL|TPOINT,
 10011001                 0,      RDEST,
 10021002                 "       movq AR,AL\n", },
 10031003 
 10041004 { ASSIGN,       FOREFF|INAREG,
 10051005         SAREG|SNAME|SOREG,      TWORD,
 10061006         SAREG,          TWORD,
 10071007                 0,      RDEST,
 10081008                 "       movl AR,AL\n", },
 10091009 
 10101010 { ASSIGN,       FOREFF|INAREG,
 10111011         SAREG,                  TWORD,
 10121012         SAREG|SNAME|SOREG,      TWORD,
 10131013                 0,      RDEST,
 10141014                 "       movl AR,AL\n", },
 10151015 
 10161016 { ASSIGN,       FOREFF|INAREG,
 10171017         SAREG,                  TPOINT,
 10181018         SAREG|SNAME|SOREG,      TPOINT,
 10191019                 0,      RDEST,
 10201020                 "       movq AR,AL\n", },
 10211021 
 10221022 { ASSIGN,       FOREFF|INAREG,
 10231023         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
 10241024         SAREG,          TSHORT|TUSHORT,
 10251025                 0,      RDEST,
 10261026                 "       movw AR,AL\n", },
 10271027 
 10281028 { ASSIGN,       FOREFF|INAREG,
 10291029         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 10301030         SAREG,          TCHAR|TUCHAR|TWORD,
 10311031                 0,      RDEST,
 10321032                 "       movb AR,AL\n", },
 10331033 
 10341034 { ASSIGN,       INBREG|FOREFF,
 10351035         SBREG,                  TFLOAT|TDOUBLE,
 10361036         SBREG|SOREG|SNAME,      TFLOAT|TDOUBLE,
 10371037                 0,      RDEST,
 10381038                 "       movsZf AR,AL\n", },
 10391039 
 10401040 { ASSIGN,       INBREG|FOREFF,
 10411041         SBREG|SOREG|SNAME,      TFLOAT|TDOUBLE,
 10421042         SBREG,                  TFLOAT|TDOUBLE,
 10431043                 0,      RDEST,
 10441044                 "       movsZf AR,AL\n", },
 10451045 
 10461046 /* x87 entries */
 10471047 { ASSIGN,       INDREG|FOREFF,
 10481048         SHFL,   TLDOUBLE,
 10491049         SHFL,   TLDOUBLE,
 10501050                 0,      RDEST,
 10511051                 "", }, /* This will always be in the correct register */
 10521052 
 10531053 /* order of table entries is very important here! */
 10541054 { ASSIGN,       INFL,
 10551055         SNAME|SOREG,    TLDOUBLE,
 10561056         SHFL,   TLDOUBLE,
 10571057                 0,      RDEST,
 10581058                 "       fstpt AL\n      fldt AL\n", }, /* XXX */
 10591059 
 10601060 { ASSIGN,       FOREFF,
 10611061         SNAME|SOREG,    TLDOUBLE,
 10621062         SHFL,   TLDOUBLE,
 10631063                 0,      0,
 10641064                 "       fstpt AL\n", },
 10651065 
 10661066 /* end very important order */
 10671067 
 10681068 { ASSIGN,       INFL|FOREFF,
 10691069         SHFL,           TLDOUBLE,
 10701070         SHFL|SOREG|SNAME,       TLDOUBLE,
 10711071                 0,      RDEST,
 10721072                 "       fldt AR\n", },
 10731073 
 10741074 /* end x87 */
 10751075 
 10761076 /* Do not generate memcpy if return from funcall */
 10771077 #if 0
 10781078 { STASG,        INAREG|FOREFF,
 10791079         SOREG|SNAME|SAREG,      TPTRTO|TSTRUCT,
 10801080         SFUNCALL,       TPTRTO|TSTRUCT,
 10811081                 0,      RRIGHT,
 10821082                 "", },
 10831083 #endif
 10841084 
 10851085 { STASG,        INAREG|FOREFF,
 10861086         SOREG|SNAME,    TANY,
 10871087         SAREG,          TPTRTO|TANY,
 10881088                 NSPECIAL|NAREGRDEST,
 10891089                 "F      movq AR,A1\nZQF movq A1,AR\n", },
 10901090 
 10911091 /*
 10921092  * DIV/MOD/MUL
 10931093  */
 10941094 { DIV,  INAREG,
 10951095         SAREG,                  TLONG,
 10961096         SAREG|SNAME|SOREG,      TLL,
 10971097                 NSPECIAL,       RDEST,
 10981098                 "       cqto\n  idivq AR\n", },
 10991099 
 11001100 { DIV,  INAREG,
 11011101         SAREG,                  TULONG|TPOINT,
 11021102         SAREG|SNAME|SOREG,      TLL|TPOINT,
 11031103                 NSPECIAL,       RDEST,
 11041104                 "       xorq %rdx,%rdx\n        divq AR\n", },
 11051105 
 11061106 { DIV,  INAREG,
 11071107         SAREG,                  TSWORD,
 11081108         SAREG|SNAME|SOREG,      TWORD,
 11091109                 NSPECIAL,       RDEST,
 11101110                 "       cltd\n  idivl AR\n", },
 11111111 
 11121112 { DIV,  INAREG,
 11131113         SAREG,                  TUWORD,
 11141114         SAREG|SNAME|SOREG,      TWORD,
 11151115                 NSPECIAL,       RDEST,
 11161116                 "       xorl %edx,%edx\n        divl AR\n", },
 11171117 
 11181118 { DIV,  INAREG,
 11191119         SAREG,                  TUSHORT,
 11201120         SAREG|SNAME|SOREG,      TUSHORT,
 11211121                 NSPECIAL,       RDEST,
 11221122                 "       xorl %edx,%edx\n        divw AR\n", },
 11231123 
 11241124 { DIV,  INAREG,
 11251125         SAREG,                  TUCHAR,
 11261126         SAREG|SNAME|SOREG,      TUCHAR,
 11271127                 NSPECIAL,       RDEST,
 11281128                 "       xorb %ah,%ah\n  divb AR\n", },
 11291129 
 11301130 { DIV,  INBREG,
 11311131         SBREG,                  TFLOAT|TDOUBLE,
 11321132         SBREG|SNAME|SOREG,      TFLOAT|TDOUBLE,
 11331133                 0,      RLEFT,
 11341134                 "       divsZf AR,AL\n", },
 11351135 
 11361136 { DIV,  INCREG,
 11371137         SHFL,           TLDOUBLE,
 11381138         SHFL,           TLDOUBLE,
 11391139                 0,      RLEFT,
 11401140                 "       fdivZAp\n", },
 11411141 
 11421142 { MOD,  INAREG,
 11431143         SAREG,                  TLONG,
 11441144         SAREG|SNAME|SOREG,      TLONG,
 11451145                 NAREG|NSPECIALRESC1,
 11461146                 "       cqto\n  idivq AR\n", },
 11471147 
 11481148 { MOD,  INAREG,
 11491149         SAREG,                  TLL|TPOINT,
 11501150         SAREG|SNAME|SOREG,      TULONG|TPOINT,
 11511151                 NAREG|NSPECIALRESC1,
 11521152                 "       xorq %rdx,%rdx\n        divq AR\n", },
 11531153 
 11541154 { MOD,  INAREG,
 11551155         SAREG,                  TSWORD,
 11561156         SAREG|SNAME|SOREG,      TSWORD,
 11571157                 NAREG|NSPECIALRESC1,
 11581158                 "       cltd\n  idivl AR\n", },
 11591159 
 11601160 { MOD,  INAREG,
 11611161         SAREG,                  TWORD,
 11621162         SAREG|SNAME|SOREG,      TUWORD,
 11631163                 NAREG|NSPECIALRESC1,
 11641164                 "       xorl %edx,%edx\n        divl AR\n", },
 11651165 
 11661166 { MOD,  INAREG,
 11671167         SAREG,                  TUSHORT,
 11681168         SAREG|SNAME|SOREG,      TUSHORT,
 11691169                 NAREG|NSPECIALRESC1,
 11701170                 "       xorl %edx,%edx\n        divw AR\n", },
 11711171 
 11721172 { MOD,  INAREG,
 11731173         SAREG,                  TUCHAR,
 11741174         SAREG|SNAME|SOREG,      TUCHAR,
 11751175                 NAREG|NSPECIALRESC1,
 11761176                 "       xorb %ah,%ah\n  divb AR\n       movb %ah,%al\n", },
 11771177 
 11781178 { MUL,  INAREG,
 11791179         SAREG,                          TLL|TPOINT,
 11801180         SAREG|SNAME|SOREG,              TLL|TPOINT,
 11811181                 0,      RLEFT,
 11821182                 "       imulq AR,AL\n", },
 11831183 
 11841184 { MUL,  INAREG,
 11851185         SAREG,                          TWORD,
 11861186         SAREG|SNAME|SOREG|SCON,         TWORD,
 11871187                 0,      RLEFT,
 11881188                 "       imull AR,AL\n", },
 11891189 
 11901190 { MUL,  INAREG,
 11911191         SAREG,                  TSHORT|TUSHORT,
 11921192         SAREG|SNAME|SOREG,      TSHORT|TUSHORT,
 11931193                 0,      RLEFT,
 11941194                 "       imulw AR,AL\n", },
 11951195 
 11961196 { MUL,  INAREG,
 11971197         SAREG,                  TCHAR|TUCHAR,
 11981198         SAREG|SNAME|SOREG,      TCHAR|TUCHAR,
 11991199                 NSPECIAL,       RLEFT,
 12001200                 "       imulb AR\n", },
 12011201 
 12021202 { MUL,  INBREG,
 12031203         SBREG,                  TFLOAT|TDOUBLE,
 12041204         SBREG|SNAME|SOREG,      TFLOAT|TDOUBLE,
 12051205                 0,      RLEFT,
 12061206                 "       mulsZf AR,AL\n", },
 12071207 
 12081208 { MUL,  INCREG,
 12091209         SHFL,           TLDOUBLE,
 12101210         SHFL,           TLDOUBLE,
 12111211                 0,      RLEFT,
 12121212                 "       fmulp\n", },
 12131213 
 12141214 /*
 12151215  * Indirection operators.
 12161216  */
 12171217 { UMULINAREG,
 12181218         SANY,   TANY,
 12191219         SOREG,  TLL|TPOINT,
 12201220                 NAREG,  RESC1,
 12211221                 "       movq AL,A1\n", },
 12221222 
 12231223 { UMULINAREG,
 12241224         SANY,   TWORD,
 12251225         SOREG,  TWORD,
 12261226                 NAREG|NASL,     RESC1,
 12271227                 "       movl AL,A1\n", },
 12281228 
 12291229 { UMULINAREG,
 12301230         SANY,   TANY,
 12311231         SOREG,  TCHAR|TUCHAR,
 12321232                 NAREG|NASL,     RESC1,
 12331233                 "       movb AL,A1\n", },
 12341234 
 12351235 { UMULINAREG,
 12361236         SANY,   TANY,
 12371237         SOREG,  TSHORT|TUSHORT,
 12381238                 NAREG|NASL,     RESC1,
 12391239                 "       movw AL,A1\n", },
 12401240 
 12411241 { UMULINBREG,
 12421242         SANY,   TANY,
 12431243         SOREG,  TFLOAT|TDOUBLE,
 12441244                 NBREG|NBSL,     RESC1,
 12451245                 "       movsZf AL,A1\n", },
 12461246 
 12471247 { UMULINCREG,
 12481248         SANY,   TANY,
 12491249         SOREG,  TLDOUBLE,
 12501250                 NCREG|NCSL,     RESC1,
 12511251                 "       fldt AL\n", },
 12521252 
 12531253 /*
 12541254  * Logical/branching operators
 12551255  */
 12561256 
 12571257 /* Comparisions, take care of everything */
 12581258 
 12591259 { OPLOG,        FORCC,
 12601260         SAREG,                  TLL|TPOINT,
 12611261         SAREG|SOREG|SNAME,      TLL|TPOINT,
 12621262                 0,      RESCC,
 12631263                 "       cmpq AR,AL\n", },
 12641264 
 12651265 { OPLOG,        FORCC,
 12661266         SAREG|SOREG|SNAME,      TLL|TPOINT,
 12671267         SAREG,                  TLL|TPOINT,
 12681268                 0,      RESCC,
 12691269                 "       cmpq AR,AL\n", },
 12701270 
 12711271 { OPLOG,        FORCC,
 12721272         SAREG|SOREG|SNAME,      TLL|TPOINT,
 12731273         SCON32,                 TANY,
 12741274                 0,      RESCC,
 12751275                 "       cmpq AR,AL\n", },
 12761276 
 12771277 { OPLOG,        FORCC,
 12781278         SAREG|SOREG|SNAME,      TWORD,
 12791279         SCON|SAREG,     TWORD,
 12801280                 0,      RESCC,
 12811281                 "       cmpl AR,AL\n", },
 12821282 
 12831283 { OPLOG,        FORCC,
<>1284 -        SCON|SAREG,     TWORD,
  1284+        /* SCON| XXX fix switch in tree of L/R */ SAREG,        TWORD,
<_12851285         SAREG|SOREG|SNAME,      TWORD,
 12861286                 0,      RESCC,
 12871287                 "       cmpl AR,AL\n", },
 12881288 
 12891289 { OPLOG,        FORCC,
 12901290         SAREG|SOREG|SNAME,      TSHORT|TUSHORT,
 12911291         SCON|SAREG,     TANY,
 12921292                 0,      RESCC,
 12931293                 "       cmpw AR,AL\n", },
 12941294 
 12951295 { OPLOG,        FORCC,
 12961296         SAREG|SOREG|SNAME,      TCHAR|TUCHAR,
 12971297         SCON|SAREG,     TANY,
 12981298                 0,      RESCC,
 12991299                 "       cmpb AR,AL\n", },
 13001300 
 13011301 { OPLOG,        FORCC,
 13021302         SBREG,                  TDOUBLE|TFLOAT,
 13031303         SBREG|SNAME|SOREG,      TDOUBLE|TFLOAT,
 13041304                 0,              RNOP,
 13051305                 "       ucomisZg AR,AL\nZU\n", },
 13061306 
 13071307 /* x87 */
 13081308 { OPLOG,        FORCC,
 13091309         SCREG,  TLDOUBLE,
 13101310         SCREG,  TLDOUBLE,
 13111311                 0,      RNOP,
 13121312                 "ZG", },
 13131313 
 13141314 { OPLOG,        FORCC,
 13151315         SANY,   TANY,
 13161316         SANY,   TANY,
 13171317                 REWRITE,        0,
 13181318                 "diediedie!", },
 13191319 
 13201320 /* AND/OR/ER/NOT */
 13211321 { AND,  INAREG|FOREFF,
 13221322         SAREG|SOREG|SNAME,      TLL,
 13231323         SCON,                   TWORD,
 13241324                 0,      RLEFT,
 13251325                 "       andq AR,AL\n", },
 13261326 
 13271327 { AND,  INAREG|FOREFF,
 13281328         SAREG|SOREG|SNAME,      TLL,
 13291329         SAREG,                  TLL,
 13301330                 0,      RLEFT,
 13311331                 "       andq AR,AL\n", },
 13321332 
 13331333 { AND,  INAREG|FOREFF,
 13341334         SAREG,                  TLL,
 13351335         SAREG|SOREG|SNAME,      TLL,
 13361336                 0,      RLEFT,
 13371337                 "       andq AR,AL\n", },
 13381338 
 13391339 { AND,  INAREG|FOREFF,
 13401340         SAREG|SOREG|SNAME,      TWORD,
 13411341         SCON|SAREG,             TWORD,
 13421342                 0,      RLEFT,
 13431343                 "       andl AR,AL\n", },
 13441344 
 13451345 { AND,  INAREG|FOREFF,
 13461346         SAREG,                  TWORD,
 13471347         SAREG|SOREG|SNAME,      TWORD,
 13481348                 0,      RLEFT,
 13491349                 "       andl AR,AL\n", },
 13501350 
 13511351 { AND,  INAREG|FOREFF
 13521352         SAREG|SOREG|SNAME,      TSHORT|TUSHORT,
 13531353         SCON|SAREG,             TSHORT|TUSHORT,
 13541354                 0,      RLEFT,
 13551355                 "       andw AR,AL\n", },
 13561356 
 13571357 { AND,  INAREG|FOREFF
 13581358         SAREG,                  TSHORT|TUSHORT,
 13591359         SAREG|SOREG|SNAME,      TSHORT|TUSHORT,
 13601360                 0,      RLEFT,
 13611361                 "       andw AR,AL\n", },
 13621362 
 13631363 { AND,  INAREG|FOREFF,
 13641364         SAREG|SOREG|SNAME,      TCHAR|TUCHAR,
 13651365         SCON|SAREG,             TCHAR|TUCHAR,
 13661366                 0,      RLEFT,
 13671367                 "       andb AR,AL\n", },
 13681368 
 13691369 { AND,  INAREG|FOREFF,
 13701370         SAREG,                  TCHAR|TUCHAR,
 13711371         SAREG|SOREG|SNAME,      TCHAR|TUCHAR,
 13721372                 0,      RLEFT,
 13731373                 "       andb AR,AL\n", },
 13741374 /* AND/OR/ER/NOT */
 13751375 
 13761376 /*
 13771377  * Jumps.
 13781378  */
 13791379 { GOTO,         FOREFF,
 13801380         SCON,   TANY,
 13811381         SANY,   TANY,
 13821382                 0,      RNOP,
 13831383                 "       jmp LL\n", },
 13841384 
 13851385 #if defined(GCC_COMPAT) || defined(LANG_F77)
 13861386 { GOTO,         FOREFF,
 13871387         SAREG,  TANY,
 13881388         SANY,   TANY,
 13891389                 0,      RNOP,
 13901390                 "       jmp *AL\n", },
 13911391 #endif
 13921392 
 13931393 /*
 13941394  * Convert LTYPE to reg.
 13951395  */
 13961396 { OPLTYPE,      FORCC|INAREG,
 13971397         SAREG,  TLL|TPOINT,
 13981398         SMIXORTANY,
 13991399                 NAREG,  RESC1,
 14001400                 "       xorq A1,A1\n", },
 14011401 
 14021402 { OPLTYPE,      INAREG,
 14031403         SANY,   TANY,
 14041404         SAREG|SCON|SOREG|SNAMETLL|TPOINT,
 14051405                 NAREG,  RESC1,
 14061406                 "       movq AL,A1\n", },
 14071407 
 14081408 { OPLTYPE,      FORCC|INAREG,
 14091409         SAREG,  TWORD,
 14101410         SMIXORTANY,
 14111411                 NAREG|NASL,     RESC1,
 14121412                 "       xorl A1,A1\n", },
 14131413 
 14141414 { OPLTYPE,      INAREG,
 14151415         SANY,   TANY,
 14161416         SAREG|SCON|SOREG|SNAMETWORD,
 14171417                 NAREG|NASL,     RESC1,
 14181418                 "       movl AL,A1\n", },
 14191419 
 14201420 { OPLTYPE,      INAREG,
 14211421         SANY,   TANY,
 14221422         SAREG|SOREG|SNAME|SCONTCHAR|TUCHAR,
 14231423                 NAREG,  RESC1,
 14241424                 "       movb AL,A1\n", },
 14251425 
 14261426 { OPLTYPE,      FORCC|INAREG,
 14271427         SAREG,  TSHORT|TUSHORT,
 14281428         SMIXORTANY,
 14291429                 NAREG,  RESC1,
 14301430                 "       xorw A1,A1\n", },
 14311431 
 14321432 { OPLTYPE,      INAREG,
 14331433         SANY,   TANY,
 14341434         SAREG|SOREG|SNAME|SCONTSHORT|TUSHORT,
 14351435                 NAREG,  RESC1,
 14361436                 "       movw AL,A1\n", },
 14371437 
 14381438 { OPLTYPE,      INBREG,
 14391439         SANY,           TFLOAT|TDOUBLE,
 14401440         SOREG|SNAME|SBREG,      TFLOAT|TDOUBLE,
 14411441                 NBREG,  RESC1,
 14421442                 "       movsZf AL,A1\n", },
 14431443 
 14441444 /* x87 entry */
 14451445 { OPLTYPE,      INCREG,
 14461446         SANY,           TLDOUBLE,
 14471447         SOREG|SNAME,    TLDOUBLE,
 14481448                 NCREG,  RESC1,
 14491449                 "       fldt AL\n", },
 14501450 
 14511451 /* load float 0.0 */
 14521452 { FCON,         INBREG,
 14531453         SANY,           TFLOAT|TDOUBLE,
 14541454         SANY,           TFLOAT|TDOUBLE,
 14551455                 NBREG,  RESC1,
 14561456                 "       xorpZf A1,A1\n", },
 14571457 
 14581458 { FCON,         INCREG,
 14591459         SANY,           TLDOUBLE,
 14601460         SANY,           TLDOUBLE,
 14611461                 NCREG,  RESC1,
 14621462                 "       fldz\n", },
 14631463 
 14641464 
 14651465 /*
 14661466  * Negate a word.
 14671467  */
 14681468 
 14691469 { UMINUS,       INAREG|FOREFF,
 14701470         SAREG,  TLL|TPOINT,
 14711471         SAREG,  TLL|TPOINT,
 14721472                 0,      RLEFT,
 14731473                 "       negq AL\n", },
 14741474 
 14751475 { UMINUS,       INAREG|FOREFF,
 14761476         SAREG,  TWORD,
 14771477         SAREG,  TWORD,
 14781478                 0,      RLEFT,
 14791479                 "       negl AL\n", },
 14801480 
 14811481 { UMINUS,       INAREG|FOREFF,
 14821482         SAREG,  TSHORT|TUSHORT,
 14831483         SAREG,  TSHORT|TUSHORT,
 14841484                 0,      RLEFT,
 14851485                 "       negw AL\n", },
 14861486 
 14871487 { UMINUS,       INAREG|FOREFF,
 14881488         SAREG,  TCHAR|TUCHAR,
 14891489         SAREG,  TCHAR|TUCHAR,
 14901490                 0,      RLEFT,
 14911491                 "       negb AL\n", },
 14921492 
 14931493 { UMINUS,       INBREG,
 14941494         SBREG,          TDOUBLE|TFLOAT,
 14951495         SBREG,          TDOUBLE|TFLOAT,
 14961496                 0,      RLEFT,
 14971497                 "       xorpZf LC(%rip),AL\n", },
 14981498 
 14991499 { UMINUS,       INCREG,
 15001500         SCREG,  TLDOUBLE,
 15011501         SCREG,  TLDOUBLE,
 15021502                 0,      RLEFT,
 15031503                 "       fchs\n", },
 15041504 
 15051505 { COMPL,        INAREG,
 15061506         SAREG,  TLL,
 15071507         SANY,   TANY,
 15081508                 0,      RLEFT,
 15091509                 "       notq AL\n", },
 15101510 
 15111511 { COMPL,        INAREG,
 15121512         SAREG,  TWORD,
 15131513         SANY,   TANY,
 15141514                 0,      RLEFT,
 15151515                 "       notl AL\n", },
 15161516 
 15171517 { COMPL,        INAREG,
 15181518         SAREG,  TSHORT|TUSHORT,
 15191519         SANY,   TANY,
 15201520                 0,      RLEFT,
 15211521                 "       notw AL\n", },
 15221522 
 15231523 { COMPL,        INAREG,
 15241524         SAREG,  TCHAR|TUCHAR,
 15251525         SANY,   TANY,
 15261526                 0,      RLEFT,
 15271527                 "       notb AL\n", },
 15281528 
 15291529 { STARG,        FOREFF,
 15301530         SAREG|SOREG|SNAME|SCON, TANY,
 15311531         SANY,   TSTRUCT,
 15321532                 NSPECIAL, 0,
 15331533                 "ZF", },
 15341534 
 15351535 { ADDROF,       INAREG,
 15361536         SNAME,  TANY,
 15371537         SANY,   TANY,
 15381538                 NAREG, RESC1,
 15391539                 "       leaq AL,A1\n", },
 15401540 
 15411541 # define DF(x) FORREW,SANY,TANY,SANY,TANY,REWRITE,x,""
 15421542 
 15431543 { UMUL, DF( UMUL ), },
 15441544 
 15451545 { ASSIGN, DF(ASSIGN), },
 15461546 
 15471547 { STASG, DF(STASG), },
 15481548 
 15491549 { FLD, DF(FLD), },
 15501550 
 15511551 { OPLEAF, DF(NAME), },
 15521552 
 15531553 /* { INIT, DF(INIT), }, */
 15541554 
 15551555 { OPUNARY, DF(UMINUS), },
 15561556 
 15571557 { OPANY, DF(BITYPE), },
 15581558 
 15591559 { FREEFREE,   FREE,   FREE,   FREE,   FREE,   FREE,   FREE,   "help; I'm in trouble\n" },
 15601560 };
 15611561 
 15621562 int tablesize = sizeof(table)/sizeof(table[0]);
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-22 10:56 +0100