Skip to content

Commit d88e1c7

Browse files
gretay-jspoechsel
authored andcommitted
Remove Cmm.memory_chunk.Double_u (#42)
* Add missing case for Ispecific rdtsc in an exhaustive match * Remove Cmm.memory_chunk.Double_u All current targets treat Double_u the same as Double. * Update comment for Double * Remove Cmm.memory_chunk.Double_u All current targets treat Double_u the same as Double. * Update comment for Double * Fixup after a rebase
1 parent fbfebb0 commit d88e1c7

36 files changed

+84
-94
lines changed

backend/amd64/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ let emit_instr fallthrough i =
726726
I.movsxd (addressing addr DWORD i 0) dest
727727
| Single ->
728728
I.cvtss2sd (addressing addr REAL4 i 0) dest
729-
| Double | Double_u ->
729+
| Double ->
730730
I.movsd (addressing addr REAL8 i 0) dest
731731
end
732732
| Lop(Istore(chunk, addr, _)) ->
@@ -742,7 +742,7 @@ let emit_instr fallthrough i =
742742
| Single ->
743743
I.cvtsd2ss (arg i 0) xmm15;
744744
I.movss xmm15 (addressing addr REAL4 i 1)
745-
| Double | Double_u ->
745+
| Double ->
746746
I.movsd (arg i 0) (addressing addr REAL8 i 1)
747747
end
748748
| Lop(Ialloc { bytes = n; dbginfo }) ->

backend/amd64/proc.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ let destroyed_at_oper = function
324324
| Icheckbound),_))
325325
| Iop(Istore((Byte_unsigned | Byte_signed | Sixteen_unsigned | Sixteen_signed
326326
| Thirtytwo_unsigned | Thirtytwo_signed | Word_int | Word_val
327-
| Double | Double_u), _, _))
327+
| Double ), _, _))
328328
| Iop(Imove | Ispill | Ireload | Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf
329329
| Ifloatofint | Iintoffloat
330330
| Iconst_int _ | Iconst_float _ | Iconst_symbol _
@@ -379,7 +379,7 @@ let max_register_pressure = function
379379
| Iasr | Ipopcnt | Iclz _| Ictz _|Icheckbound), _)
380380
| Istore((Byte_unsigned | Byte_signed | Sixteen_unsigned | Sixteen_signed
381381
| Thirtytwo_unsigned | Thirtytwo_signed | Word_int | Word_val
382-
| Double | Double_u),
382+
| Double ),
383383
_, _)
384384
| Imove | Ispill | Ireload | Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf
385385
| Ifloatofint | Iintoffloat | Iconst_int _ | Iconst_float _ | Iconst_symbol _

backend/amd64/selection.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ let pseudoregs_for_operation op arg res =
133133
| Iintop_imm ((Imulh|Idiv|Imod|Icomp _|Icheckbound
134134
|Ipopcnt|Iclz _|Ictz _), _)
135135
| Ispecific (Isqrtf|Isextend32|Izextend32|Ilea _|Istore_int (_, _, _)
136-
|Ioffset_loc (_, _)|Ifloatsqrtf _|Irdtsc)
136+
|Ioffset_loc (_, _)|Ifloatsqrtf _ |Irdtsc)
137137
| Imove|Ispill|Ireload|Ifloatofint|Iintoffloat|Iconst_int _|Iconst_float _
138138
| Iconst_symbol _|Icall_ind|Icall_imm _|Itailcall_ind|Itailcall_imm _
139139
| Iextcall _|Istackoffset _|Iload (_, _)|Istore (_, _, _)|Ialloc _
@@ -235,7 +235,7 @@ method! select_operation op args dbg =
235235
self#select_floatarith false Idivf Ifloatdiv args
236236
| Cextcall { name = "sqrt"; alloc = false; } ->
237237
begin match args with
238-
[Cop(Cload ((Double|Double_u as chunk), _), [loc], _dbg)] ->
238+
[Cop(Cload ((Double as chunk), _), [loc], _dbg)] ->
239239
let (addr, arg) = self#select_addressing chunk loc in
240240
(Ispecific(Ifloatsqrtf addr), [arg])
241241
| [arg] ->
@@ -293,11 +293,11 @@ method! select_operation op args dbg =
293293

294294
method select_floatarith commutative regular_op mem_op args =
295295
match args with
296-
[arg1; Cop(Cload ((Double|Double_u as chunk), _), [loc2], _)] ->
296+
[arg1; Cop(Cload ((Double as chunk), _), [loc2], _)] ->
297297
let (addr, arg2) = self#select_addressing chunk loc2 in
298298
(Ispecific(Ifloatarithmem(mem_op, addr)),
299299
[arg1; arg2])
300-
| [Cop(Cload ((Double|Double_u as chunk), _), [loc1], _); arg2]
300+
| [Cop(Cload ((Double as chunk), _), [loc1], _); arg2]
301301
when commutative ->
302302
let (addr, arg1) = self#select_addressing chunk loc1 in
303303
(Ispecific(Ifloatarithmem(mem_op, addr)),

backend/arm/emit.mlp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ let emit_instr i =
582582
| Lop(Iload(Single, addr)) when !fpu >= VFPv2 ->
583583
` flds s14, {emit_addressing addr i.arg 0}\n`;
584584
` fcvtds {emit_reg i.res.(0)}, s14\n`; 2
585-
| Lop(Iload((Double | Double_u), addr)) when !fpu = Soft ->
585+
| Lop(Iload(Double, addr)) when !fpu = Soft ->
586586
(* Use LDM or LDRD if possible *)
587587
begin match i.res.(0), i.res.(1), addr with
588588
{loc = Reg rt}, {loc = Reg rt2}, Iindexed 0
@@ -609,14 +609,13 @@ let emit_instr i =
609609
| Byte_signed -> "ldrsb"
610610
| Sixteen_unsigned -> "ldrh"
611611
| Sixteen_signed -> "ldrsh"
612-
| Double
613-
| Double_u -> "fldd"
612+
| Double -> "fldd"
614613
| _ (* 32-bit quantities *) -> "ldr" in
615614
` {emit_string instr} {emit_reg r}, {emit_addressing addr i.arg 0}\n`; 1
616615
| Lop(Istore(Single, addr, _)) when !fpu >= VFPv2 ->
617616
` fcvtsd s14, {emit_reg i.arg.(0)}\n`;
618617
` fsts s14, {emit_addressing addr i.arg 1}\n`; 2
619-
| Lop(Istore((Double | Double_u), addr, _)) when !fpu = Soft ->
618+
| Lop(Istore(Double, addr, _)) when !fpu = Soft ->
620619
(* Use STM or STRD if possible *)
621620
begin match i.arg.(0), i.arg.(1), addr with
622621
{loc = Reg rt}, {loc = Reg rt2}, Iindexed 0
@@ -638,8 +637,7 @@ let emit_instr i =
638637
| Byte_signed -> "strb"
639638
| Sixteen_unsigned
640639
| Sixteen_signed -> "strh"
641-
| Double
642-
| Double_u -> "fstd"
640+
| Double -> "fstd"
643641
| _ (* 32-bit quantities *) -> "str" in
644642
` {emit_string instr} {emit_reg r}, {emit_addressing addr i.arg 1}\n`; 1
645643
| Lop(Ialloc { bytes = n; dbginfo }) ->

backend/arm/selection.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ open Mach
2424
let is_offset chunk n =
2525
match chunk with
2626
(* VFPv{2,3} load/store have -1020 to 1020. Offset must be multiple of 4 *)
27-
| Single | Double | Double_u
27+
| Single | Double
2828
when !fpu >= VFPv2 ->
2929
n >= -1020 && n <= 1020 && n mod 4 = 0
3030
(* ARM load/store byte/word have -4095 to 4095 *)

backend/arm64/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ let emit_instr i =
746746
| Single ->
747747
` ldr s7, {emit_addressing addr base}\n`;
748748
` fcvt {emit_reg dst}, s7\n`
749-
| Word_int | Word_val | Double | Double_u ->
749+
| Word_int | Word_val | Double ->
750750
` ldr {emit_reg dst}, {emit_addressing addr base}\n`
751751
end
752752
| Lop(Istore(size, addr, _)) ->
@@ -768,7 +768,7 @@ let emit_instr i =
768768
| Single ->
769769
` fcvt s7, {emit_reg src}\n`;
770770
` str s7, {emit_addressing addr base}\n`;
771-
| Word_int | Word_val | Double | Double_u ->
771+
| Word_int | Word_val | Double ->
772772
` str {emit_reg src}, {emit_addressing addr base}\n`
773773
end
774774
| Lop(Ialloc { bytes = n; dbginfo }) ->

backend/arm64/selection.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let is_offset chunk n =
3131
n land 1 = 0 && n lsr 1 < 0x1000
3232
| Thirtytwo_unsigned | Thirtytwo_signed | Single ->
3333
n land 3 = 0 && n lsr 2 < 0x1000
34-
| Word_int | Word_val | Double | Double_u ->
34+
| Word_int | Word_val | Double ->
3535
n land 7 = 0 && n lsr 3 < 0x1000)
3636

3737
(* An automaton to recognize ( 0+1+0* | 1+0+1* )

backend/cmm.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ type memory_chunk =
149149
| Word_val
150150
| Single
151151
| Double
152-
| Double_u
153152

154153
and operation =
155154
Capply of machtype

backend/cmm.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ type memory_chunk =
138138
| Word_int (* integer or pointer outside heap *)
139139
| Word_val (* pointer inside heap or encoded int *)
140140
| Single
141-
| Double (* 64-bit-aligned 64-bit float *)
142-
| Double_u (* word-aligned 64-bit float *)
141+
| Double (* word-aligned 64-bit float
142+
see PR#10433 *)
143143

144144
and operation =
145145
Capply of machtype

backend/cmm_helpers.ml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -569,18 +569,18 @@ let unbox_float dbg =
569569
| Some (Uconst_float x) ->
570570
Cconst_float (x, dbg) (* or keep _dbg? *)
571571
| _ ->
572-
Cop(Cload (Double_u, Immutable), [cmm], dbg)
572+
Cop(Cload (Double, Immutable), [cmm], dbg)
573573
end
574-
| cmm -> Cop(Cload (Double_u, Immutable), [cmm], dbg)
574+
| cmm -> Cop(Cload (Double, Immutable), [cmm], dbg)
575575
)
576576

577577
(* Complex *)
578578

579579
let box_complex dbg c_re c_im =
580580
Cop(Calloc, [alloc_floatarray_header 2 dbg; c_re; c_im], dbg)
581581

582-
let complex_re c dbg = Cop(Cload (Double_u, Immutable), [c], dbg)
583-
let complex_im c dbg = Cop(Cload (Double_u, Immutable),
582+
let complex_re c dbg = Cop(Cload (Double, Immutable), [c], dbg)
583+
let complex_im c dbg = Cop(Cload (Double, Immutable),
584584
[Cop(Cadda, [c; Cconst_int (size_float, dbg)], dbg)],
585585
dbg)
586586

@@ -728,7 +728,7 @@ let int_array_ref arr ofs dbg =
728728
Cop(Cload (Word_int, Mutable),
729729
[array_indexing log2_size_addr arr ofs dbg], dbg)
730730
let unboxed_float_array_ref arr ofs dbg =
731-
Cop(Cload (Double_u, Mutable),
731+
Cop(Cload (Double, Mutable),
732732
[array_indexing log2_size_float arr ofs dbg], dbg)
733733
let float_array_ref arr ofs dbg =
734734
box_float dbg (unboxed_float_array_ref arr ofs dbg)
@@ -751,7 +751,7 @@ let int_array_set arr ofs newval dbg =
751751
Cop(Cstore (Word_int, Lambda.Assignment),
752752
[array_indexing log2_size_addr arr ofs dbg; newval], dbg)
753753
let float_array_set arr ofs newval dbg =
754-
Cop(Cstore (Double_u, Lambda.Assignment),
754+
Cop(Cstore (Double, Lambda.Assignment),
755755
[array_indexing log2_size_float arr ofs dbg; newval], dbg)
756756

757757
(* String length *)
@@ -2114,7 +2114,7 @@ let generic_functions shared units =
21142114
type unary_primitive = expression -> Debuginfo.t -> expression
21152115

21162116
let floatfield n ptr dbg =
2117-
Cop(Cload (Double_u, Mutable),
2117+
Cop(Cload (Double, Mutable),
21182118
[if n = 0 then ptr
21192119
else Cop(Cadda, [ptr; Cconst_int(n * size_float, dbg)], dbg)],
21202120
dbg)
@@ -2275,7 +2275,7 @@ let setfield n ptr init arg1 arg2 dbg =
22752275

22762276
let setfloatfield n init arg1 arg2 dbg =
22772277
return_unit dbg (
2278-
Cop(Cstore (Double_u, init),
2278+
Cop(Cstore (Double, init),
22792279
[if n = 0 then arg1
22802280
else Cop(Cadda, [arg1; Cconst_int(n * size_float, dbg)], dbg);
22812281
arg2], dbg))
@@ -2698,9 +2698,9 @@ let transl_builtin name args dbg =
26982698
| "caml_native_pointer_store_unboxed_int32" ->
26992699
Some(Cop(Cstore (Thirtytwo_signed, Assignment), args, dbg))
27002700
| "caml_native_pointer_load_unboxed_float" ->
2701-
Some(Cop(Cload (Double_u, Mutable), args, dbg))
2701+
Some(Cop(Cload (Double, Mutable), args, dbg))
27022702
| "caml_native_pointer_store_unboxed_float" ->
2703-
Some(Cop(Cstore (Double_u, Assignment), args, dbg))
2703+
Some(Cop(Cstore (Double, Assignment), args, dbg))
27042704
(* Ext_pointer: handled as tagged int *)
27052705
| "caml_ext_pointer_load_immediate"
27062706
| "caml_ext_pointer_load_unboxed_nativeint" ->
@@ -2717,9 +2717,9 @@ let transl_builtin name args dbg =
27172717
| "caml_ext_pointer_store_unboxed_int32" ->
27182718
ext_pointer_store Thirtytwo_signed name args dbg
27192719
| "caml_ext_pointer_load_unboxed_float" ->
2720-
ext_pointer_load Double_u name args dbg
2720+
ext_pointer_load Double name args dbg
27212721
| "caml_ext_pointer_store_unboxed_float" ->
2722-
ext_pointer_store Double_u name args dbg
2722+
ext_pointer_store Double name args dbg
27232723
| _ -> None
27242724

27252725
(* [cextcall] is called from [Cmmgen.transl_ccall] *)

backend/i386/CSE.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ method! class_of_operation op =
2929
(* Operations that affect the floating-point stack cannot be factored *)
3030
| Iconst_float _ | Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf
3131
| Iintoffloat | Ifloatofint
32-
| Iload((Single | Double | Double_u), _) -> Op_other
32+
| Iload((Single | Double), _) -> Op_other
3333
(* Specific ops *)
3434
| Ispecific(Ilea _) -> Op_pure
3535
| Ispecific(Istore_int(_, _, is_asg)) -> Op_store is_asg

backend/i386/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ let emit_instr fallthrough i =
584584
I.movsx (addressing addr WORD i 0) (reg dest)
585585
| Single ->
586586
I.fld (addressing addr REAL4 i 0)
587-
| Double | Double_u ->
587+
| Double ->
588588
I.fld (addressing addr REAL8 i 0)
589589
end
590590
| Lop(Istore(chunk, addr, _)) ->
@@ -602,7 +602,7 @@ let emit_instr fallthrough i =
602602
I.fld (reg i.arg.(0));
603603
I.fstp (addressing addr REAL4 i 1)
604604
end
605-
| Double | Double_u ->
605+
| Double ->
606606
if is_tos i.arg.(0) then
607607
I.fstp (addressing addr REAL8 i 1)
608608
else begin

backend/i386/selection.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ let pseudoregs_for_operation op arg res =
133133
(* For floating-point operations and floating-point loads,
134134
the result is always left at the top of the floating-point stack *)
135135
| Iconst_float _ | Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf
136-
| Ifloatofint | Iload((Single | Double | Double_u), _)
136+
| Ifloatofint | Iload((Single | Double ), _)
137137
| Ispecific(Isubfrev | Idivfrev | Ifloatarithmem _ | Ifloatspecial _) ->
138138
(arg, [| tos |], false) (* don't move it immediately *)
139139
(* For storing a byte, the argument must be in eax...edx.
@@ -149,7 +149,6 @@ let pseudoregs_for_operation op arg res =
149149
let chunk_double = function
150150
Single -> false
151151
| Double -> true
152-
| Double_u -> true
153152
| _ -> assert false
154153

155154
(* The selector class *)
@@ -293,8 +292,8 @@ method select_push exp =
293292
| Cop(Cload ((Word_int | Word_val as chunk), _), [loc], _) ->
294293
let (addr, arg) = self#select_addressing chunk loc in
295294
(Ispecific(Ipush_load addr), arg)
296-
| Cop(Cload (Double_u, _), [loc], _) ->
297-
let (addr, arg) = self#select_addressing Double_u loc in
295+
| Cop(Cload (Double, _), [loc], _) ->
296+
let (addr, arg) = self#select_addressing Double loc in
298297
(Ispecific(Ipush_load_float addr), arg)
299298
| _ -> (Ispecific(Ipush), exp)
300299

backend/power/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ let emit_instr i =
742742
| Thirtytwo_signed -> if ppc64 then "lwa" else "lwz"
743743
| Word_int | Word_val -> lg
744744
| Single -> "lfs"
745-
| Double | Double_u -> "lfd" in
745+
| Double -> "lfd" in
746746
emit_load_store loadinstr addr i.arg 0 i.res.(0);
747747
if chunk = Byte_signed then
748748
` extsb {emit_reg i.res.(0)}, {emit_reg i.res.(0)}\n`
@@ -754,7 +754,7 @@ let emit_instr i =
754754
| Thirtytwo_unsigned | Thirtytwo_signed -> "stw"
755755
| Word_int | Word_val -> stg
756756
| Single -> "stfs"
757-
| Double | Double_u -> "stfd" in
757+
| Double -> "stfd" in
758758
emit_load_store storeinstr addr i.arg 1 i.arg.(0)
759759
| Lop(Ialloc { bytes = n; dbginfo }) ->
760760
if !call_gc_label = 0 then call_gc_label := new_label ();

backend/printcmm.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ let chunk = function
8585
| Word_val -> "val"
8686
| Single -> "float32"
8787
| Double -> "float64"
88-
| Double_u -> "float64u"
8988

9089
let phantom_defining_expr ppf defining_expr =
9190
match defining_expr with

backend/riscv/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ let emit_instr i =
353353
| Thirtytwo_signed -> "lw"
354354
| Word_int | Word_val -> "ld"
355355
| Single -> assert false
356-
| Double | Double_u -> "fld"
356+
| Double -> "fld"
357357
in
358358
` {emit_string instr} {emit_reg i.res.(0)}, {emit_int ofs}({emit_reg i.arg.(0)})\n`
359359
| Lop(Istore(Single, Iindexed ofs, _)) ->
@@ -368,7 +368,7 @@ let emit_instr i =
368368
| Thirtytwo_unsigned | Thirtytwo_signed -> "sw"
369369
| Word_int | Word_val -> "sd"
370370
| Single -> assert false
371-
| Double | Double_u -> "fsd"
371+
| Double -> "fsd"
372372
in
373373
` {emit_string instr} {emit_reg i.arg.(0)}, {emit_int ofs}({emit_reg i.arg.(1)})\n`
374374
| Lop(Ialloc {bytes; dbginfo}) ->

backend/s390x/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ let emit_instr i =
403403
| Thirtytwo_signed -> "lgf"
404404
| Word_int | Word_val -> "lg"
405405
| Single -> "ley"
406-
| Double | Double_u -> "ldy" in
406+
| Double -> "ldy" in
407407
emit_load_store loadinstr addr i.arg 0 i.res.(0);
408408
if chunk = Single then
409409
` ldebr {emit_reg i.res.(0)}, {emit_reg i.res.(0)}\n`
@@ -419,7 +419,7 @@ let emit_instr i =
419419
| Thirtytwo_unsigned | Thirtytwo_signed -> "sty"
420420
| Word_int | Word_val -> "stg"
421421
| Single -> assert false
422-
| Double | Double_u -> "stdy" in
422+
| Double -> "stdy" in
423423
emit_load_store storeinstr addr i.arg 1 i.arg.(0)
424424

425425
| Lop(Ialloc { bytes = n; dbginfo }) ->

backend/selectgen.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ let oper_result_type = function
7070
| Cload (c, _) ->
7171
begin match c with
7272
| Word_val -> typ_val
73-
| Single | Double | Double_u -> typ_float
73+
| Single | Double -> typ_float
7474
| _ -> typ_int
7575
end
7676
| Calloc -> typ_val
@@ -1000,7 +1000,7 @@ method emit_stores env data regs_addr =
10001000
Istore(_, _, _) ->
10011001
for i = 0 to Array.length regs - 1 do
10021002
let r = regs.(i) in
1003-
let kind = if r.typ = Float then Double_u else Word_val in
1003+
let kind = if r.typ = Float then Double else Word_val in
10041004
self#insert env
10051005
(Iop(Istore(kind, !a, false)))
10061006
(Array.append [|r|] regs_addr) [||];

ocaml/asmcomp/amd64/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ let emit_instr fallthrough i =
718718
I.movsxd (addressing addr DWORD i 0) dest
719719
| Single ->
720720
I.cvtss2sd (addressing addr REAL4 i 0) dest
721-
| Double | Double_u ->
721+
| Double ->
722722
I.movsd (addressing addr REAL8 i 0) dest
723723
end
724724
| Lop(Istore(chunk, addr, _)) ->
@@ -734,7 +734,7 @@ let emit_instr fallthrough i =
734734
| Single ->
735735
I.cvtsd2ss (arg i 0) xmm15;
736736
I.movss xmm15 (addressing addr REAL4 i 1)
737-
| Double | Double_u ->
737+
| Double ->
738738
I.movsd (arg i 0) (addressing addr REAL8 i 1)
739739
end
740740
| Lop(Ialloc { bytes = n; dbginfo }) ->

0 commit comments

Comments
 (0)