-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathi386.specmd
executable file
·24880 lines (22536 loc) · 631 KB
/
i386.specmd
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
{:
;; GCC machine description for IA-32 and x86-64.
;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
;; Free Software Foundation, Inc.
;; Mostly by William Schelter.
;; x86_64 support added by Jan Hubicka
;;
;; This file is part of GCC.
;;
;; 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 3, or (at your option)
;; any later version.
;;
;; 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 GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>. */
;;
;; The original PO technology requires these to be ordered by speed,
;; so that assigner will pick the fastest.
;;
;; See file "rtl.def" for documentation on define_insn, match_*, et. al.
;;
;; The special asm out single letter directives following a '%' are:
;; L,W,B,Q,S,T -- print the opcode suffix for specified size of operand.
;; C -- print opcode suffix for set/cmov insn.
;; c -- like C, but print reversed condition
;; F,f -- likewise, but for floating-point.
;; O -- if HAVE_AS_IX86_CMOV_SUN_SYNTAX, expand to "w.", "l." or "q.",
;; otherwise nothing
;; R -- print the prefix for register names.
;; z -- print the opcode suffix for the size of the current operand.
;; Z -- likewise, with special suffixes for x87 instructions.
;; * -- print a star (in certain assembler syntax)
;; A -- print an absolute memory reference.
;; E -- print address with DImode register names if TARGET_64BIT.
;; w -- print the operand as if it's a "word" (HImode) even if it isn't.
;; s -- print a shift double count, followed by the assemblers argument
;; delimiter.
;; b -- print the QImode name of the register for the indicated operand.
;; %b0 would print %al if operands[0] is reg 0.
;; w -- likewise, print the HImode name of the register.
;; k -- likewise, print the SImode name of the register.
;; q -- likewise, print the DImode name of the register.
;; x -- likewise, print the V4SFmode name of the register.
;; t -- likewise, print the V8SFmode name of the register.
;; h -- print the QImode name for a "high" register, either ah, bh, ch or dh.
;; y -- print "st(0)" instead of "st" as a register.
;; d -- print duplicated register operand for AVX instruction.
;; D -- print condition for SSE cmp instruction.
;; P -- if PIC, print an @PLT suffix.
;; p -- print raw symbol name.
;; X -- don't print any sort of PIC '@' suffix for a symbol.
;; & -- print some in-use local-dynamic symbol name.
;; H -- print a memory address offset by 8; used for sse high-parts
;; Y -- print condition for XOP pcom* instruction.
;; + -- print a branch hint as 'cs' or 'ds' prefix
;; ; -- print a semicolon (after prefixes due to bug in older gas).
;; @ -- print a segment register of thread base pointer load
:}
list "unspec".c_enum [
UNSPEC_GOT
,UNSPEC_GOTOFF
,UNSPEC_GOTPCREL
,UNSPEC_GOTTPOFF
,UNSPEC_TPOFF
,UNSPEC_NTPOFF
,UNSPEC_DTPOFF
,UNSPEC_GOTNTPOFF
,UNSPEC_INDNTPOFF
,UNSPEC_PLTOFF
,UNSPEC_MACHOPIC_OFFSET
,UNSPEC_PCREL
,UNSPEC_STACK_ALLOC
,UNSPEC_SET_GOT
,UNSPEC_SET_RIP
,UNSPEC_SET_GOT_OFFSET
,UNSPEC_MEMORY_BLOCKAGE
,UNSPEC_STACK_CHECK
,UNSPEC_TP
,UNSPEC_TLS_GD
,UNSPEC_TLS_LD_BASE
,UNSPEC_TLSDESC
,UNSPEC_TLS_IE_SUN
,UNSPEC_SCAS
,UNSPEC_FNSTSW
,UNSPEC_SAHF
,UNSPEC_PARITY
,UNSPEC_FSTCW
,UNSPEC_ADD_CARRY
,UNSPEC_FLDCW
,UNSPEC_REP
,UNSPEC_LD_MPIC
,UNSPEC_TRUNC_NOOP
,UNSPEC_DIV_ALREADY_SPLIT
,UNSPEC_MS_TO_SYSV_CALL
,UNSPEC_CALL_NEEDS_VZEROUPPER
,UNSPEC_PAUSE
,UNSPEC_LEA_ADDR
,UNSPEC_FIX_NOTRUNC
,UNSPEC_MASKMOV
,UNSPEC_MOVMSK
,UNSPEC_RCP
,UNSPEC_RSQRT
,UNSPEC_PSADBW
,UNSPEC_COPYSIGN
,UNSPEC_IEEE_MIN
,UNSPEC_IEEE_MAX
,UNSPEC_SIN
,UNSPEC_COS
,UNSPEC_FPATAN
,UNSPEC_FYL2X
,UNSPEC_FYL2XP1
,UNSPEC_FRNDINT
,UNSPEC_FIST
,UNSPEC_F2XM1
,UNSPEC_TAN
,UNSPEC_FXAM
,UNSPEC_FRNDINT_FLOOR
,UNSPEC_FRNDINT_CEIL
,UNSPEC_FRNDINT_TRUNC
,UNSPEC_FRNDINT_MASK_PM
,UNSPEC_FIST_FLOOR
,UNSPEC_FIST_CEIL
,UNSPEC_SINCOS_COS
,UNSPEC_SINCOS_SIN
,UNSPEC_XTRACT_FRACT
,UNSPEC_XTRACT_EXP
,UNSPEC_FSCALE_FRACT
,UNSPEC_FSCALE_EXP
,UNSPEC_FPREM_F
,UNSPEC_FPREM_U
,UNSPEC_FPREM1_F
,UNSPEC_FPREM1_U
,UNSPEC_C2_FLAG
,UNSPEC_FXAM_MEM
,UNSPEC_SP_SET
,UNSPEC_SP_TEST
,UNSPEC_SP_TLS_SET
,UNSPEC_SP_TLS_TEST
,UNSPEC_ROUND
,UNSPEC_CRC32
,UNSPEC_BEXTR
,UNSPEC_PDEP
,UNSPEC_PEXT
]
list "unspecv".c_enum [
UNSPECV_BLOCKAGE
,UNSPECV_STACK_PROBE
,UNSPECV_PROBE_STACK_RANGE
,UNSPECV_ALIGN
,UNSPECV_PROLOGUE_USE
,UNSPECV_SPLIT_STACK_RETURN
,UNSPECV_CLD
,UNSPECV_NOPS
,UNSPECV_RDTSC
,UNSPECV_RDTSCP
,UNSPECV_RDPMC
,UNSPECV_LLWP_INTRINSIC
,UNSPECV_SLWP_INTRINSIC
,UNSPECV_LWPVAL_INTRINSIC
,UNSPECV_LWPINS_INTRINSIC
,UNSPECV_RDFSBASE
,UNSPECV_RDGSBASE
,UNSPECV_WRFSBASE
,UNSPECV_WRGSBASE
,UNSPECV_RDRAND
]
{:
;; Constants to represent rounding modes in the ROUND instruction
:}
list noname.constants
[(ROUND_FLOOR,0x1),(ROUND_CEIL,0x2),
(ROUND_TRUNC,0x3),(ROUND_MXCSR,0x4),
(ROUND_NO_EXC,0x8)]
{:
;; Constants to represent pcomtrue/pcomfalse variants
:}
{:
;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
;; from i386.c.
;; In C guard expressions, put expressions which may be compile-time
;; constants first. This allows for better optimization. For
;; example, write "TARGET_64BIT && reload_completed", not
;; "reload_completed && TARGET_64BIT".
;; Processor type.
:}
concrete cpu.attr instantiates const
{
root (symbol_ref:"ix86_schedule");
lov:="none,pentium,pentiumpro,geode,k6,athlon,k8,core2,corei7,
atom,generic64,amdfam10,bdver1,bdver2,btver1";
}
{:
;; A basic instruction type. Refinements due to arguments to be
;; provided in other attributes.
:}
concrete type.attr instantiates sequence
{
root (const_string:"other");
lov:="other,multi,
alu,alu1,negnot,imov,imovx,lea,
incdec,ishift,ishiftx,ishift1,rotate,rotatex,rotate1,imul,imulx,idiv,
icmp,test,ibr,setcc,icmov,
push,pop,call,callv,leave,
str,bitmanip,
fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint,
sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,
ssemuladd,sse4arg,lwp, mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft";
}
{:
;; Main data type used by the insn
:}
concrete mode.attr instantiates sequence
{
root (const_string:"unknown");
lov:="unknown,none,QI,HI,SI,DI,TI,OI,SF,DF,XF,TF,V8SF,V4DF,V4SF,V2DF,V2SF,V1DF";
}
{:
;; The CPU unit operations uses.
:}
abstract cond_sequence extends cond
{
root.1:=sequence;
}
concrete unit.attr instantiates cond_sequence
{
root ((type:"fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,fisttp,frndint",
const_string:"i387", type:"sselog,sselog1,sseiadd,sseiadd1,sseishft,sseishft1,sseimul,
sse,ssemov,sseadd,ssemul,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,ssediv,sseins,ssemuladd,sse4arg",
const_string:"sse", type:"mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft",
type:"mmx", const_string:"unknown"), const_string:"integer");
lov:="integer,i387,sse,mmx,unknown";
}
abstract cond_sequence_ite_x2 extends cond_sequence
{
root.1.10:=if_then_else;
root.1.12:=if_then_else;
}
{:
;; The (bounding maximum) length of an instruction immediate.
:}
concrete length_immediate.attr instantiates cond_sequence_ite_x2
{
root ((type:"incdec,setcc,icmov,str,lea,other,multi,idiv,leave, bitmanip,imulx",
const_int:0, unit:"i387,sse,mmx", const_int:0,
type:"alu,alu1,negnot,imovx,ishift,ishiftx,ishift1,
rotate,rotatex,rotate1,imul,icmp,push,pop",
symbol_ref:"ix86_attr_length_immediate_default (insn, true)",
type:"imov,test", symbol_ref:"ix86_attr_length_immediate_default (insn, false)",
type:"call", 0=constant_call_address_operand:NULL:"",
const_int:4, const_int:0, type:"callv", 1=constant_call_address_operand:NULL:"",
const_int:4, const_int:0,type:"ibr", const_int:1),
symbol_ref: "gcc_unreachable (),1");
}
{:
;; The (bounding maximum) length of an instruction address.
:}
abstract cond_and3_and5 extends cond_sequence
{
root.1.3:=and;
root.1.5:=and;
}
concrete length_address.attr instantiates cond_and3_and5
{
root ((type:"str,other,multi,fxch", const_int:0,
type:"call", 0=constant_call_address_operand:NULL:"",const_int:0,
type:"callv", 1=constant_call_address_operand:NULL:"",const_int:0),
symbol_ref:"ix86_attr_length_address_default (insn)");
}
{:
;; Set when length prefix is used.
:}
abstract cond_and5 extends cond_sequence
{
root.1.5:=and;
}
concrete prefix_data16.attr instantiates cond_and5
{
root ((type:"ssemuladd,sse4arg,sseiadd1,ssecvt1", const_int:0,
mode:"HI",const_int:1,
unit:"sse",mode:"V2DF,TI",const_int:1), const_int:0);
}
abstract cond_and3 extends cond_sequence
{
root.1.3:=and;
}
concrete prefix_rep.attr instantiates cond_and3
{
root ((type:"ssemuladd,sse4arg,sseiadd1,ssecvt1", const_int:0,
unit:"sse",mode:"SF,DF", const_int:1), const_int:0);
}
abstract ite_ior1 extends if_then_else
{
root.1:=ior;
}
concrete prefix_0f.attr instantiates ite_ior1
{
root (type:"imovx,setcc,icmov,bitmanip", unit:"sse,mmx",
const_int:1, const_int:0);
}
abstract cond_not1_and3_and2_and5 extends cond_sequence
{
root.1.1:=not;
root.1.3:=and;
root.1.3.2:=and;
root.1.5:=and;
}
concrete prefix_rex.attr instantiates cond_not1_and3_and2_and5
{
root ((match_test:"TARGET_64BIT",const_int:0,
mode:"DI",type:"!push,pop,call,callv,leave,ibr",unit:"!mmx",const_int:1,
mode:"QI", match_test:"x86_extended_QIreg_mentioned_p (insn)", const_int:1,
type:"imovx", 1=ext_QIreg_operand:QI:"", const_int:1), const_int:0);
}
{:
;; There are also additional prefixes in 3DNOW, SSSE3.
;; ssemuladd,sse4arg default to 0f24/0f25 and DREX byte,
;; sseiadd1,ssecvt1 to 0f7a with no DREX byte.
;; 3DNOW has 0f0f prefix, SSSE3 and SSE4_{1,2} 0f38/0f3a.
:}
concrete prefix_extra.attr instantiates cond_sequence
{
root ((type:"ssemuladd,sse4arg", const_int:2,
type:"sseiadd1,ssecvt1", const_int:1),
const_int:0);
}
concrete prefix.attr instantiates if_then_else
{
root (mode:"OI,V8SF,V4DF",
const_string:"vex", const_string:"orig");
lov:="orig,vex,maybe_vex";
}
concrete prefix_vex_w.attr instantiates sequence
{
root (const_int:0);
}
{:
;; The length of VEX prefix
;; Only instructions with 0f prefix can have 2 byte VEX prefix,
;; 0f38/0f3a prefixes can't. In i386.md 0f3[8a] is
;; still prefix_0f 1, with prefix_extra 1.
:}
abstract ite_and1_ite2_ite3 extends if_then_else
{
root.1:=and; root.2:=if_then_else; root.3:=if_then_else;
}
concrete length_vex.attr instantiates ite_and1_ite2_ite3
{
root (prefix_0f:"1", prefix_extra:"0",
prefix_vex_w:"1", symbol_ref:"ix86_attr_length_vex_default (insn, true, true)",
symbol_ref:"ix86_attr_length_vex_default (insn, true, false)",
prefix_vex_w:"1", symbol_ref:"ix86_attr_length_vex_default (insn, false, true)",
symbol_ref:"ix86_attr_length_vex_default (insn, false, false)");
}
abstract ctree1 extends cond_sequence
{
root.1.5:=and; root.1.5.2:=and; root.1.5.2.1:=not;
root.1.5.2.2:=ior; root.1.7:=and; root.1.7.2:=not;
root.1.9:=and; root.1.9.2:=not; root.1.11:=and;
root.1.11.2:=and; root.1.11.2.1:=not; root.1.11.2.2:=ior;
root.1.11.2.2.1:=and; root.1.11.2.2.2:=ior;
root.1.11.2.2.2.1:=and; root.1.11.2.2.2.2:=and;
root.1.13:=and; root.1.15:=and;
}
{:
;; Set when modrm byte is used.
:}
concrete modrm.attr instantiates ctree1
{
root ((type:"str,leave", const_int:0,
unit:"i387",const_int:0,
type:"incdec", match_test:"TARGET_64BIT",
1=register_operand:SI:"", 1=register_operand:HI:"", const_int:0,
type:"push", 1=memory_operand:NULL:"", const_int:0,
type:"pop", 0=memory_operand:NULL:"", const_int:0,
type:"imov", mode:"DI", 0=register_operand:NULL:"",
1=immediate_operand:NULL:"", 0=ax_reg_operand:NULL:"",
0=memory_displacement_only_operand:NULL:"",
1=ax_reg_operand:NULL:"",const_int:0,
type:"call",0=constant_call_address_operand:NULL:"",const_int:0,
type:"callv",1=constant_call_address_operand:NULL:"", const_int:0,
type:"alu,alu1,icmp,test",0=ax_reg_operand:NULL:"",
symbol_ref:"(get_attr_length_immediate (insn) <= (get_attr_mode (insn) != MODE_QI))"),
const_int:1);
}
abstract ctree3 extends cond_sequence
{
root.1.6:=plus; root.1.6.2:=plus; root.1.7:=ior;
root.1.7.2:=and; root.1.8:=plus; root.1.8.2:=plus; root.1.8.2.2:=plus;
root.2:=plus; root.2.1:=plus; root.2.1.2:=plus; root.2.1.2.2:=plus;
root.2.1.2.2.2:=plus; root.2.2:=plus; root.2.2.2:=plus; root.2.2.2.2:=plus;
}
{:
;; The (bounding maximum) length of an instruction in bytes.
;; ??? fistp and frndint are in fact fldcw/{fistp,frndint}/fldcw sequences.
;; Later we may want to split them and compute proper length as for
;; other insns.
:}
concrete length.attr instantiates ctree3
{
root ((type:"other,multi,fistp,frndint", const_int:16,
type:"fcmp",const_int:4,
unit:"i387", const_int:2, attr:"prefix_data16", attr:"length_address",
prefix:"vex", prefix:"maybe_vex", match_test:"TARGET_AVX",
attr:"length_vex", attr:"length_immediate", attr:"modrm", attr:"length_address"),
attr:"modrm",attr:"prefix_0f", attr:"prefix_rex", attr:"prefix_extra", const_int:1,
attr:"prefix_rep",attr:"prefix_data16",attr:"length_immediate",attr:"length_address");
}
abstract ctree2 extends cond_sequence
{
root.1.10:=if_then_else; root.1.12:=if_then_else;
root.1.14:=if_then_else; root.1.16:=if_then_else;
root.1.16.1:=ior; root.1.18:=if_then_else;
root.1.20:=if_then_else; root.1.22:=if_then_else;
root.1.23:=and; root.1.25:=and;
root.1.31:=and; root.1.33:=and;
}
{:
;; The `memory' attribute is `none' if no memory is referenced, `load' or
;; `store' if there is a simple memory reference therein, or `unknown'
;; if the instruction is complex.
:}
concrete memory.attr instantiates ctree2
{
root ((type:"other,multi,str,lwp",const_string:"unknown",
type:"lea,fcmov,fpspc", const_string:"none",
type:"fistp,leave", const_string:"both",
type:"frndint", const_string:"load",
type:"push", 1=memory_operand:NULL:"", const_string:"both", const_string:"store",
type:"pop", 0=memory_operand:NULL:"", const_string:"both", const_string:"load",
type:"setcc", 0=memory_operand:NULL:"", const_string:"store", const_string:"none",
type:"icmp,test,ssecmp,ssecomi,mmxcmp,fcmp",
0=memory_operand:NULL:"", 1=memory_operand:NULL:"", const_string:"load",
const_string:"none",
type:"ibr", 0=memory_operand:NULL:"", const_string:"load",const_string:"none",
type:"call", 0=constant_call_address_operand:NULL:"", const_string:"none", const_string:"load",
type:"callv", 1=constant_call_address_operand:NULL:"", const_string:"none", const_string:"load",
type:"alu1,negnot,ishift1,sselog1", 1=memory_operand:NULL:"", 1=memory_operand:NULL:"", const_string:"both",
0=memory_operand:NULL:"", 1=memory_operand:NULL:"", const_string:"both",
0=memory_operand:NULL:"", const_string:"store",
1=memory_operand:NULL:"", const_string:"load",
type:"!alu1,negnot,ishift1,imov,imovx,icmp,test,bitmanip,fmov,fcmp,fsgn,
sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,sselog1,sseiadd1,
mmx,mmxmov,mmxcmp,mmxcvt",2=memory_operand:NULL:"", const_string:"load",
type:"icmov,ssemuladd,sse4arg",3=memory_operand:NULL:"", const_string:"load"),
const_string:"none");
lov:="none,load,store,both,unknown";
}
abstract cond_and3_and2_and5_and2 extends cond_and3_and5
{
root.1.3.2:=and;
root.1.5.2:=and;
}
{:
;; Indicates if an instruction has both an immediate and a displacement.
:}
concrete imm_disp.attr instantiates cond_and3_and2_and5_and2
{
root ((type:"other,multi", const_string:"unknown",
type:"icmp,test,imov,alu1,ishift1,rotate1",
0=memory_displacement_operand:NULL:"",
1=immediate_operand:NULL:"", const_string:"true",
type:"alu,ishift,ishiftx,rotate,rotatex,imul,idiv",
0=memory_displacement_operand:NULL:"",
2=immediate_operand:NULL:"", const_string:"true"),
const_string:"false");
}
{:
;; Indicates if an FP operation has an integer source.
:}
concrete fp_int_src.attr instantiates sequence
{
root (const_string:"false");
lov:="false,true";
}
{:
;; Defines rounding mode of an FP operation.
:}
concrete i387_cw.attr instantiates sequence
{
root (const_string:"any");
lov:="trunc,floor,ceil,mask_pm,uninitialized,any";
}
{:
;; Define attribute to classify add/sub insns that consumes carry flag (CF)
:}
concrete use_carry.attr instantiates sequence
{
root (const_string:"0");
lov:="0,1";
}
{:
;; Define attribute to indicate unaligned ssemov insns
:}
concrete movu.attr instantiates sequence
{
root (const_string:"0");
lov:="0,1";
}
{:
;; Used to control the "enabled" attribute on a per-instruction basis.
:}
concrete isa.attr instantiates sequence
{
root (const_string:"base");
lov:="base,sse2,sse2_noavx,sse3,sse4,sse4_noavx,noavx,avx,bmi2,fma,fma4";
}
{:
;; Fma instruction selection has to be done based on
;; register pressure. For generating fma4, a cost model
;; based on register pressure is required. Till then,
;; fma4 instruction is disabled for targets that implement
;; both fma and fma4 instruction sets.
:}
concrete enabled.attr instantiates cond_sequence
{
root ((isa:"sse2", symbol_ref:"TARGET_SSE2",
isa:"sse2_noavx", symbol_ref:"TARGET_SSE2 && !TARGET_AVX",
isa:"sse3", symbol_ref:"TARGET_SSE3",
isa:"sse4", symbol_ref:"TARGET_SSE4_1",
isa:"sse4_noavx", symbol_ref:"TARGET_SSE4_1 && !TARGET_AVX",
isa:"avx", symbol_ref:"TARGET_AVX",
isa:"noavx", symbol_ref:"!TARGET_AVX",
isa:"bmi2", symbol_ref:"TARGET_BMI2",
isa:"fma", symbol_ref:"TARGET_FMA",
isa:"fma4", symbol_ref:"TARGET_FMA4 && !TARGET_FMA"),
const_int:1);
}
{:
;; Describe a user's asm statement.
:}
list noname.asm_attr
[(set_attr,"length","128"),(set_attr,"type","multi")]
list plusminus.c_iter [plus, minus]
list any_extend.c_iter [sign_extend, zero_extend]
list absneg.c_iter [abs, neg]
list any_or.c_iter [ior, xor]
list any_shiftrt.c_iter [lshiftrt, ashiftrt]
list any_rotate.c_iter [rotate, rotatert]
list smaxmin.c_iter [smax, smin]
abstract set_if_then_else_match_operator extends set_if_then_else
{
root.2.1:=match_operator;
}
abstract set_if_then_else_match_operator_label_ref extends set_if_then_else_match_operator
{
root.2.2:=label_ref;
}
abstract set_compare_set_if_then_else_match_operator_label_ref extends sequence
{
root.1:=set_compare;
root.2:=set_if_then_else_match_operator_label_ref;
}
// SpecRTL Comments.
concrete cbranch<mode>4.exp instantiates set_compare_set_if_then_else_match_operator_label_ref
{
root(reg(CC:FLAGS_REG),1=nonimmediate_operand:SDWIM:"",2=<general_operand>:SDWIM:"",pc,(0=ordered_comparison_operator,reg(CC:FLAGS_REG),const_int:0),3=NULL:NULL:"",pc);
root.1.2.mode:=CC;
}
{:
""
{
if (MEM_P (operands[1]) && MEM_P (operands[2]))
operands[1] = force_reg (<MODE>mode, operands[1]);
ix86_expand_branch (GET_CODE (operands[0]),
operands[1], operands[2], operands[3]);
DONE;
}
:}
abstract set_compare_set_match_operator extends sequence
{
root.1:=set_compare;
root.2:=set_match_operator;
}
concrete cstore<mode>4.exp instantiates set_compare_set_match_operator
{
root(reg(CC:FLAGS_REG),2=nonimmediate_operand:SWIM:"",3=<general_operand>:SWIM:"",0=register_operand:QI:"",(1=ordered_comparison_operator,reg(CC:FLAGS_REG), const_int:0));
root.1.2.mode:=CC;
}
{:
""
{
if (MEM_P (operands[2]) && MEM_P (operands[3]))
operands[2] = force_reg (<MODE>mode, operands[2]);
ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
operands[2], operands[3]);
DONE;
}
:}
concrete cmp<mode>_1.exp instantiates set_compare
{
root (reg(CC:FLAGS_REG),0=nonimmediate_operand:SWI48:"",1=<general_operand>:SWI48:"");
root.2.mode:=CC;
}
{:
:}
concrete *cmp<mode>_ccno_1.insn instantiates set_compare
{
root(reg(NULL:FLAGS_REG),0=nonimmediate_operand:SWI:"<r>,?m<r>",1=const0_operand:SWI:"");
}
{:
"ix86_match_ccmode (insn, CCNOmode)"
"@
test{<imodesuffix>}\t%0, %0
cmp{<imodesuffix>}\t{%1, %0|%0,%1}"
[(set_attr "type" "test,icmp")
(set_attr "length_immediate" "0,1")
(set_attr "mode" "<MODE>")]
:}
concrete *cmp<mode>_1.insn overrides *cmp<mode>_ccno_1.insn
{
root.2.1:=nonimmediate_operand:SWI:"<r>m,<r>";
root.2.2:=<general_operand>:SWI:"<r><i>,<r>m";
}
{:
"ix86_match_ccmode (insn, CCmode)"
"cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
[(set_attr "type" "icmp")
(set_attr "mode" "<MODE>")]
:}
concrete *cmp<mode>_minus_1.insn instantiates set_compare_minus
{
root(reg(NULL:FLAGS_REG),0=nonimmediate_operand:SWI:"<r>m,<r>",1=<general_operand>:SWI:"<r><i>,<r>m",const_int:0);
root.2.1.mode:=SWI;
}
{:
"ix86_match_ccmode (insn, CCGOCmode)"
"cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
[(set_attr "type" "icmp")
(set_attr "mode" "<MODE>")]
:}
abstract subreg_zero_extract extends subreg{
root.1:=zero_extract;
}
abstract set_compare_subreg_zero_extract2 extends set_compare
{
root.2.2:=subreg_zero_extract;
}
concrete *cmpqi_ext_1.insn instantiates set_compare_subreg_zero_extract2
{
root (reg(NULL:FLAGS_REG),0=general_operand:QI:"Qm",1=ext_register_operand:NULL:"Q",const_int:8,const_int:8, 0);
root.2.2.mode:=QI;
root.2.2.1.mode:=SI;
}
{:
"!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
"cmp{b}\t{%h1, %0|%0, %h1}"
[(set_attr "type" "icmp")
(set_attr "mode" "QI")]
:}
concrete *cmpqi_ext_1_rex64.insn overrides *cmpqi_ext_1.insn
{
root.2.1.predicate:=register_operand;
root.2.1.constraint:=Q;
}
{:
"TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
"cmp{b}\t{%h1, %0|%0, %h1}"
[(set_attr "type" "icmp")
(set_attr "mode" "QI")]
:}
abstract set_compare_subreg_zero_extract1 extends set_compare
{
root.2.1:=subreg_zero_extract;
}
concrete *cmpqi_ext_2.insn instantiates set_compare_subreg_zero_extract1
{
root (reg(NULL:FLAGS_REG),0=ext_register_operand:NULL:"Q",const_int:8,const_int:8,<0>,1=const0_operand:QI:"");
root.2.1.mode:=QI;
root.2.1.1.mode:=SI;
}
{:
"ix86_match_ccmode (insn, CCNOmode)"
"test{b}\t%h0, %h0"
[(set_attr "type" "test")
(set_attr "length_immediate" "0")
(set_attr "mode" "QI")]
:}
concrete cmpqi_ext_3.exp instantiates set_compare_subreg_zero_extract1
{
root(reg(CC:FLAGS_REG),(0=ext_register_operand:NULL:"",const_int:8,const_int:8,<0>,1=immediate_operand:QI:""));
root.2.1.mode:=QI;
root.2.1.1.mode:=SI;
root.2.mode:=CC;
}
{:
:}
concrete *cmpqi_ext_3_insn.insn overrides *cmpqi_ext_2.insn
{
root.2.2:=general_operand:QI:"Qmn";
}
{:
"!TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
"cmp{b}\t{%1, %h0|%h0, %1}"
[(set_attr "type" "icmp")
(set_attr "modrm" "1")
(set_attr "mode" "QI")]
:}
concrete *cmpqi_ext_3_insn_rex64.insn overrides *cmpqi_ext_2.insn
{
root.2.2:=nonmemory_operand:QI:"Qn";
}
{:
"TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
"cmp{b}\t{%1, %h0|%h0, %1}"
[(set_attr "type" "icmp")
(set_attr "modrm" "1")
(set_attr "mode" "QI")]
:}
abstract set_compare_subreg_zero_extract_subreg_zero_extract extends set_compare
{
root.2.1:=subreg_zero_extract;
root.2.2:=subreg_zero_extract;
}
concrete *cmpqi_ext_4.insn instantiates set_compare_subreg_zero_extract_subreg_zero_extract
{
root(reg(NULL:FLAGS_REG),0=ext_register_operand:NULL:"Q",const_int:8,const_int:8,0,1=ext_register_operand:NULL:"Q",const_int:8,const_int:8,0);
root.2.1.mode:=QI;
root.2.1.1.mode:=SI;
root.2.2.mode:=QI;
root.2.2.1.mode:=SI;
}
{:
"ix86_match_ccmode (insn, CCmode)"
"cmp{b}\t{%h1, %h0|%h0, %h1}"
[(set_attr "type" "icmp")
(set_attr "mode" "QI")]
:}
{:
;; These implement float point compares.
;; %%% See if we can get away with VOIDmode operands on the actual insns,
;; which would allow mix and match FP modes on the compares. Which is what
;; the old patterns did, but with many more of them.
:}
concrete cbranchxf4.exp instantiates set_compare_set_if_then_else_match_operator_label_ref
{
root(reg(CC:FLAGS_REG),1=nonmemory_operand:XF:"",2=nonmemory_operand:XF:"",pc,(0=ix86_fp_comparison_operator,reg(CC:FLAGS_REG),const_int:0),3=NULL:NULL:"",pc);
root.1.2.mode:=CC;
}
{:
"TARGET_80387"
{
ix86_expand_branch (GET_CODE (operands[0]),
operands[1], operands[2], operands[3]);
DONE;
}
:}
concrete cstorexf4.exp instantiates set_compare_set_match_operator
{
root(reg(CC:FLAGS_REG),2=nonmemory_operand:XF:"",3=nonmemory_operand:XF:"",0=register_operand:QI:"",(1=ix86_fp_comparison_operator,reg(CC:FLAGS_REG),const_int:0));
root.1.2.mode:=CC;
}
{:
"TARGET_80387"
{
ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
operands[2], operands[3]);
DONE;
}
:}
{:
;; Query #1
(define_expand "cbranch<mode>4"
[(set (reg:CC FLAGS_REG)
(compare:CC (match_operand:MODEF 1 "cmp_fp_expander_operand" "")
(match_operand:MODEF 2 "cmp_fp_expander_operand" "")))
(set (pc) (if_then_else
(match_operator 0 "ix86_fp_comparison_operator"
[(reg:CC FLAGS_REG)
(const_int 0)])
(label_ref (match_operand 3 "" ""))
(pc)))]
"TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
{
ix86_expand_branch (GET_CODE (operands[0]),
operands[1], operands[2], operands[3]);
DONE;
})
(define_expand "cstore<mode>4"
[(set (reg:CC FLAGS_REG)
(compare:CC (match_operand:MODEF 2 "cmp_fp_expander_operand" "")
(match_operand:MODEF 3 "cmp_fp_expander_operand" "")))
(set (match_operand:QI 0 "register_operand" "")
(match_operator 1 "ix86_fp_comparison_operator"
[(reg:CC FLAGS_REG)
(const_int 0)]))]
"TARGET_80387 || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)"
{
ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
operands[2], operands[3]);
DONE;
})
:}
concrete cbranchcc4.exp instantiates set_if_then_else_match_operator_label_ref
{
root(pc,(0=comparison_operator,1=flags_reg_operand:NULL:"",2=const0_operand:NULL:""),3=NULL:NULL:"",pc);
}
{:
""
{
ix86_expand_branch (GET_CODE (operands[0]),
operands[1], operands[2], operands[3]);
DONE;
}
:}
concrete cstorecc4.exp instantiates set_match_operator
{
root(0=register_operand:QI:"",(1=comparison_operator,2=flags_reg_operand:NULL:"",3=const0_operand:NULL:""));
}
{:
""
{
ix86_expand_setcc (operands[0], GET_CODE (operands[1]),
operands[2], operands[3]);
DONE;
}
:}
{:
;; FP compares, step 1:
;; Set the FP condition codes.
;;
;; CCFPmode compare with exceptions
;; CCFPUmode compare with no exceptions
;; We may not use "#" to split and emit these, since the REG_DEAD notes
;; used to manage the reg stack popping would not be preserved.
:}
concrete *cmpfp_0.insn instantiates set_unspec_compare
{
root (0=register_operand:HI:"=a",(1=register_operand:NULL:"f",2=const0_operand:NULL:"",<UNSPEC_FNSTSW>));
root.2.mode:=HI;
root.2.1.mode:=CCFP;
}
{:
"X87_FLOAT_MODE_P (GET_MODE (operands[1]))
&& GET_MODE (operands[1]) == GET_MODE (operands[2])"
"* return output_fp_compare (insn, operands, false, false);"
[(set_attr "type" "multi")
(set_attr "unit" "i387")
(set (attr "mode")
(cond [(match_operand:SF 1 "" "")
(const_string "SF")
(match_operand:DF 1 "" "")
(const_string "DF")
]
(const_string "XF")))]
:}
abstract set_compare_clobber extends sequence
{
root.1:=set_compare;
root.2:=clobber;
}
abstract set_unspec_compare_set_unspec extends sequence
{
root.1:=set_unspec_compare;
root.2:=set_unspec;
}
concrete *cmpfp_0_cc.insn_and_split instantiates.in set_compare_clobber
{
root (reg(CCFP:FLAGS_REG),1=register_operand:NULL:"f",2=const0_operand:NULL:"",0=register_operand:HI:"=a");
root.1.2.mode:=CCFP;
}
cmd_spec.in
{:
"X87_FLOAT_MODE_P (GET_MODE (operands[1]))
&& TARGET_SAHF && !TARGET_CMOVE
&& GET_MODE (operands[1]) == GET_MODE (operands[2])"
"#"
"&& reload_completed"
:}
instantiates.out set_unspec_compare_set_unspec
{
root (duplicate 0,(duplicate 1, duplicate 2,<UNSPEC_FNSTSW>),reg(CC:FLAGS_REG),(duplicate 0,<UNSPEC_SAHF>));
root.1.2.mode:=HI;
root.1.2.1.mode:=CCFP;
root.2.2.mode:=CC;
}
cmd_spec.out
{:
""
[(set_attr "type" "multi")
(set_attr "unit" "i387")
(set (attr "mode")
(cond [(match_operand:SF 1 "" "")
(const_string "SF")
(match_operand:DF 1 "" "")
(const_string "DF")
]
(const_string "XF")))]
:}
concrete *cmpfp_xf.insn overrides *cmpfp_0.insn
{
root.2.1.1.mode:=XF;
root.2.1.2:=register_operand:XF:"f";
}
{:
"TARGET_80387"
"* return output_fp_compare (insn, operands, false, false);"
[(set_attr "type" "multi")
(set_attr "unit" "i387")