@@ -39,15 +39,6 @@ fn one_way_jmp(sink: &mut MachBuffer<Inst>, cc: CC, label: MachLabel) {
39
39
debug_assert_eq ! ( sink. cur_offset( ) , cond_disp_off + 4 ) ;
40
40
}
41
41
42
- /// Like `one_way_jmp` but only used if the destination is <=127 bytes away.
43
- fn short_one_way_jmp ( sink : & mut MachBuffer < Inst > , cc : CC , label : MachLabel ) {
44
- let cond_start = sink. cur_offset ( ) ;
45
- let cond_disp_off = cond_start + 1 ;
46
- sink. use_label_at_offset ( cond_disp_off, label, LabelUse :: JmpRel8 ) ;
47
- emit_short_jcc_no_offset ( sink, cc) ;
48
- debug_assert_eq ! ( sink. cur_offset( ) , cond_disp_off + 1 ) ;
49
- }
50
-
51
42
/// Like `one_way_jmp` above emitting a conditional jump, but also using
52
43
/// `MachBuffer::add_cond_branch`.
53
44
fn cond_jmp ( sink : & mut MachBuffer < Inst > , cc : CC , label : MachLabel ) {
@@ -95,34 +86,6 @@ fn emit_jcc_no_offset(sink: &mut MachBuffer<Inst>, cc: CC) {
95
86
} ) ;
96
87
}
97
88
98
- fn emit_short_jcc_no_offset ( sink : & mut MachBuffer < Inst > , cc : CC ) {
99
- // See `emit_jcc_no_offset` above for comments about subtle mismatches in
100
- // `CC` and `jcc` naming.
101
- let inst: AsmInst = match cc {
102
- CC :: Z => asm:: inst:: je_d8:: new ( 0 ) . into ( ) ,
103
- CC :: NZ => asm:: inst:: jne_d8:: new ( 0 ) . into ( ) ,
104
- CC :: B => asm:: inst:: jb_d8:: new ( 0 ) . into ( ) ,
105
- CC :: NB => asm:: inst:: jae_d8:: new ( 0 ) . into ( ) ,
106
- CC :: BE => asm:: inst:: jbe_d8:: new ( 0 ) . into ( ) ,
107
- CC :: NBE => asm:: inst:: ja_d8:: new ( 0 ) . into ( ) ,
108
- CC :: L => asm:: inst:: jl_d8:: new ( 0 ) . into ( ) ,
109
- CC :: LE => asm:: inst:: jle_d8:: new ( 0 ) . into ( ) ,
110
- CC :: NL => asm:: inst:: jge_d8:: new ( 0 ) . into ( ) ,
111
- CC :: NLE => asm:: inst:: jg_d8:: new ( 0 ) . into ( ) ,
112
- CC :: O => asm:: inst:: jo_d8:: new ( 0 ) . into ( ) ,
113
- CC :: NO => asm:: inst:: jno_d8:: new ( 0 ) . into ( ) ,
114
- CC :: P => asm:: inst:: jp_d8:: new ( 0 ) . into ( ) ,
115
- CC :: NP => asm:: inst:: jnp_d8:: new ( 0 ) . into ( ) ,
116
- CC :: S => asm:: inst:: js_d8:: new ( 0 ) . into ( ) ,
117
- CC :: NS => asm:: inst:: jns_d8:: new ( 0 ) . into ( ) ,
118
- } ;
119
- inst. encode ( & mut external:: AsmCodeSink {
120
- sink,
121
- incoming_arg_offset : 0 ,
122
- slot_offset : 0 ,
123
- } ) ;
124
- }
125
-
126
89
/// Emits an unconditional branch.
127
90
fn uncond_jmp ( sink : & mut MachBuffer < Inst > , label : MachLabel ) {
128
91
let uncond_start = sink. cur_offset ( ) ;
@@ -290,7 +253,7 @@ pub(crate) fn emit(
290
253
// go to the `idiv`.
291
254
let inst = Inst :: cmp_mi_sxb ( size, * divisor, -1 ) ;
292
255
inst. emit ( sink, info, state) ;
293
- short_one_way_jmp ( sink, CC :: NZ , do_op) ;
256
+ one_way_jmp ( sink, CC :: NZ , do_op) ;
294
257
295
258
// ... otherwise the divisor is -1 and the result is always 0. This
296
259
// is written to the destination register which will be %rax for
@@ -380,7 +343,7 @@ pub(crate) fn emit(
380
343
let next = sink. get_label ( ) ;
381
344
382
345
// Jump if cc is *not* set.
383
- short_one_way_jmp ( sink, cc. invert ( ) , next) ;
346
+ one_way_jmp ( sink, cc. invert ( ) , next) ;
384
347
Inst :: gen_move ( dst. map ( |r| r. to_reg ( ) ) , consequent. to_reg ( ) , * ty)
385
348
. emit ( sink, info, state) ;
386
349
@@ -458,7 +421,7 @@ pub(crate) fn emit(
458
421
// jne .loop_start
459
422
// TODO: Encoding the conditional jump as a short jump
460
423
// could save us us 4 bytes here.
461
- short_one_way_jmp ( sink, CC :: NZ , loop_start) ;
424
+ one_way_jmp ( sink, CC :: NZ , loop_start) ;
462
425
463
426
// The regular prologue code is going to emit a `sub` after this, so we need to
464
427
// reset the stack pointer
@@ -976,8 +939,8 @@ pub(crate) fn emit(
976
939
977
940
cmp_op. emit ( sink, info, state) ;
978
941
979
- short_one_way_jmp ( sink, CC :: NZ , do_min_max) ;
980
- short_one_way_jmp ( sink, CC :: P , propagate_nan) ;
942
+ one_way_jmp ( sink, CC :: NZ , do_min_max) ;
943
+ one_way_jmp ( sink, CC :: P , propagate_nan) ;
981
944
982
945
// Ordered and equal. The operands are bit-identical unless they are zero
983
946
// and negative zero. These instructions merge the sign bits in that
@@ -994,7 +957,7 @@ pub(crate) fn emit(
994
957
sink. bind_label ( propagate_nan, state. ctrl_plane_mut ( ) ) ;
995
958
add_op. emit ( sink, info, state) ;
996
959
997
- short_one_way_jmp ( sink, CC :: P , done) ;
960
+ one_way_jmp ( sink, CC :: P , done) ;
998
961
999
962
sink. bind_label ( do_min_max, state. ctrl_plane_mut ( ) ) ;
1000
963
min_max_op. emit ( sink, info, state) ;
@@ -1057,7 +1020,7 @@ pub(crate) fn emit(
1057
1020
// TODO use tst src, src here.
1058
1021
asm:: inst:: cmpq_mi_sxb:: new ( src, 0 ) . emit ( sink, info, state) ;
1059
1022
1060
- short_one_way_jmp ( sink, CC :: L , handle_negative) ;
1023
+ one_way_jmp ( sink, CC :: L , handle_negative) ;
1061
1024
1062
1025
// Handle a positive int64, which is the "easy" case: a signed conversion will do the
1063
1026
// right thing.
@@ -1196,14 +1159,14 @@ pub(crate) fn emit(
1196
1159
let inst = Inst :: cmp_mi_sxb ( * dst_size, Gpr :: unwrap_new ( dst. to_reg ( ) ) , 1 ) ;
1197
1160
inst. emit ( sink, info, state) ;
1198
1161
1199
- short_one_way_jmp ( sink, CC :: NO , done) ; // no overflow => done
1162
+ one_way_jmp ( sink, CC :: NO , done) ; // no overflow => done
1200
1163
1201
1164
// Check for NaN.
1202
1165
cmp_op. emit ( sink, info, state) ;
1203
1166
1204
1167
if * is_saturating {
1205
1168
let not_nan = sink. get_label ( ) ;
1206
- short_one_way_jmp ( sink, CC :: NP , not_nan) ; // go to not_nan if not a NaN
1169
+ one_way_jmp ( sink, CC :: NP , not_nan) ; // go to not_nan if not a NaN
1207
1170
1208
1171
// For NaN, emit 0.
1209
1172
let inst: AsmInst = match * dst_size {
@@ -1231,7 +1194,7 @@ pub(crate) fn emit(
1231
1194
inst. emit ( sink, info, state) ;
1232
1195
1233
1196
// Jump if >= to done.
1234
- short_one_way_jmp ( sink, CC :: NB , done) ;
1197
+ one_way_jmp ( sink, CC :: NB , done) ;
1235
1198
1236
1199
// Otherwise, put INT_MAX.
1237
1200
if * dst_size == OperandSize :: Size64 {
@@ -1424,12 +1387,12 @@ pub(crate) fn emit(
1424
1387
inst. emit ( sink, info, state) ;
1425
1388
1426
1389
let handle_large = sink. get_label ( ) ;
1427
- short_one_way_jmp ( sink, CC :: NB , handle_large) ; // jump to handle_large if src >= large_threshold
1390
+ one_way_jmp ( sink, CC :: NB , handle_large) ; // jump to handle_large if src >= large_threshold
1428
1391
1429
1392
if * is_saturating {
1430
1393
// If not NaN jump over this 0-return, otherwise return 0
1431
1394
let not_nan = sink. get_label ( ) ;
1432
- short_one_way_jmp ( sink, CC :: NP , not_nan) ;
1395
+ one_way_jmp ( sink, CC :: NP , not_nan) ;
1433
1396
1434
1397
xor_op ( dst, dst) . emit ( sink, info, state) ;
1435
1398
@@ -1450,7 +1413,7 @@ pub(crate) fn emit(
1450
1413
let inst = Inst :: cmp_mi_sxb ( * dst_size, Gpr :: unwrap_new ( dst. to_reg ( ) ) , 0 ) ;
1451
1414
inst. emit ( sink, info, state) ;
1452
1415
1453
- short_one_way_jmp ( sink, CC :: NL , done) ; // if dst >= 0, jump to done
1416
+ one_way_jmp ( sink, CC :: NL , done) ; // if dst >= 0, jump to done
1454
1417
1455
1418
if * is_saturating {
1456
1419
// The input was "small" (< 2**(width -1)), so the only way to get an integer
@@ -1485,7 +1448,7 @@ pub(crate) fn emit(
1485
1448
1486
1449
if * is_saturating {
1487
1450
let next_is_large = sink. get_label ( ) ;
1488
- short_one_way_jmp ( sink, CC :: NL , next_is_large) ; // if dst >= 0, jump to next_is_large
1451
+ one_way_jmp ( sink, CC :: NL , next_is_large) ; // if dst >= 0, jump to next_is_large
1489
1452
1490
1453
// The input was "large" (>= 2**(width -1)), so the only way to get an integer
1491
1454
// overflow is because the input was too large: saturate to the max value.
@@ -1670,7 +1633,7 @@ pub(crate) fn emit(
1670
1633
inst. emit ( sink, info, state) ;
1671
1634
1672
1635
// jnz again
1673
- short_one_way_jmp ( sink, CC :: NZ , again_label) ;
1636
+ one_way_jmp ( sink, CC :: NZ , again_label) ;
1674
1637
}
1675
1638
1676
1639
Inst :: Atomic128RmwSeq {
@@ -1790,7 +1753,7 @@ pub(crate) fn emit(
1790
1753
. emit ( sink, info, state) ;
1791
1754
1792
1755
// jnz again
1793
- short_one_way_jmp ( sink, CC :: NZ , again_label) ;
1756
+ one_way_jmp ( sink, CC :: NZ , again_label) ;
1794
1757
}
1795
1758
1796
1759
Inst :: Atomic128XchgSeq {
@@ -1830,7 +1793,7 @@ pub(crate) fn emit(
1830
1793
. emit ( sink, info, state) ;
1831
1794
1832
1795
// jnz again
1833
- short_one_way_jmp ( sink, CC :: NZ , again_label) ;
1796
+ one_way_jmp ( sink, CC :: NZ , again_label) ;
1834
1797
}
1835
1798
1836
1799
Inst :: ElfTlsGetAddr { symbol, dst } => {
0 commit comments