Skip to content

Commit d72c5fb

Browse files
gretay-jspoechsel
authored andcommitted
flambda-backend: 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 9d34d99 commit d72c5fb

18 files changed

+40
-45
lines changed

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 }) ->

asmcomp/amd64/selection.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ method! select_operation op args dbg =
203203
self#select_floatarith false Idivf Ifloatdiv args
204204
| Cextcall("sqrt", _, _, false) ->
205205
begin match args with
206-
[Cop(Cload ((Double|Double_u as chunk), _), [loc], _dbg)] ->
206+
[Cop(Cload ((Double as chunk), _), [loc], _dbg)] ->
207207
let (addr, arg) = self#select_addressing chunk loc in
208208
(Ispecific(Ifloatsqrtf addr), [arg])
209209
| [arg] ->
@@ -251,11 +251,11 @@ method! select_operation op args dbg =
251251

252252
method select_floatarith commutative regular_op mem_op args =
253253
match args with
254-
[arg1; Cop(Cload ((Double|Double_u as chunk), _), [loc2], _)] ->
254+
[arg1; Cop(Cload ((Double as chunk), _), [loc2], _)] ->
255255
let (addr, arg2) = self#select_addressing chunk loc2 in
256256
(Ispecific(Ifloatarithmem(mem_op, addr)),
257257
[arg1; arg2])
258-
| [Cop(Cload ((Double|Double_u as chunk), _), [loc1], _); arg2]
258+
| [Cop(Cload ((Double as chunk), _), [loc1], _); arg2]
259259
when commutative ->
260260
let (addr, arg1) = self#select_addressing chunk loc1 in
261261
(Ispecific(Ifloatarithmem(mem_op, addr)),

asmcomp/arm/emit.mlp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ let emit_instr i =
578578
| Lop(Iload(Single, addr)) when !fpu >= VFPv2 ->
579579
` flds s14, {emit_addressing addr i.arg 0}\n`;
580580
` fcvtds {emit_reg i.res.(0)}, s14\n`; 2
581-
| Lop(Iload((Double | Double_u), addr)) when !fpu = Soft ->
581+
| Lop(Iload(Double, addr)) when !fpu = Soft ->
582582
(* Use LDM or LDRD if possible *)
583583
begin match i.res.(0), i.res.(1), addr with
584584
{loc = Reg rt}, {loc = Reg rt2}, Iindexed 0
@@ -605,14 +605,13 @@ let emit_instr i =
605605
| Byte_signed -> "ldrsb"
606606
| Sixteen_unsigned -> "ldrh"
607607
| Sixteen_signed -> "ldrsh"
608-
| Double
609-
| Double_u -> "fldd"
608+
| Double -> "fldd"
610609
| _ (* 32-bit quantities *) -> "ldr" in
611610
` {emit_string instr} {emit_reg r}, {emit_addressing addr i.arg 0}\n`; 1
612611
| Lop(Istore(Single, addr, _)) when !fpu >= VFPv2 ->
613612
` fcvtsd s14, {emit_reg i.arg.(0)}\n`;
614613
` fsts s14, {emit_addressing addr i.arg 1}\n`; 2
615-
| Lop(Istore((Double | Double_u), addr, _)) when !fpu = Soft ->
614+
| Lop(Istore(Double, addr, _)) when !fpu = Soft ->
616615
(* Use STM or STRD if possible *)
617616
begin match i.arg.(0), i.arg.(1), addr with
618617
{loc = Reg rt}, {loc = Reg rt2}, Iindexed 0
@@ -634,8 +633,7 @@ let emit_instr i =
634633
| Byte_signed -> "strb"
635634
| Sixteen_unsigned
636635
| Sixteen_signed -> "strh"
637-
| Double
638-
| Double_u -> "fstd"
636+
| Double -> "fstd"
639637
| _ (* 32-bit quantities *) -> "str" in
640638
` {emit_string instr} {emit_reg r}, {emit_addressing addr i.arg 1}\n`; 1
641639
| Lop(Ialloc { bytes = n; dbginfo }) ->

asmcomp/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 *)

asmcomp/arm64/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ let emit_instr i =
744744
| Single ->
745745
` ldr s7, {emit_addressing addr base}\n`;
746746
` fcvt {emit_reg dst}, s7\n`
747-
| Word_int | Word_val | Double | Double_u ->
747+
| Word_int | Word_val | Double ->
748748
` ldr {emit_reg dst}, {emit_addressing addr base}\n`
749749
end
750750
| Lop(Istore(size, addr, _)) ->
@@ -766,7 +766,7 @@ let emit_instr i =
766766
| Single ->
767767
` fcvt s7, {emit_reg src}\n`;
768768
` str s7, {emit_addressing addr base}\n`;
769-
| Word_int | Word_val | Double | Double_u ->
769+
| Word_int | Word_val | Double ->
770770
` str {emit_reg src}, {emit_addressing addr base}\n`
771771
end
772772
| Lop(Ialloc { bytes = n; dbginfo }) ->

asmcomp/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* )

asmcomp/cmm.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ type memory_chunk =
146146
| Word_val
147147
| Single
148148
| Double
149-
| Double_u
150149

151150
and operation =
152151
Capply of machtype

asmcomp/cmm.mli

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

141141
and operation =
142142
Capply of machtype

asmcomp/cmm_helpers.ml

Lines changed: 8 additions & 8 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)
@@ -743,7 +743,7 @@ let int_array_set arr ofs newval dbg =
743743
Cop(Cstore (Word_int, Lambda.Assignment),
744744
[array_indexing log2_size_addr arr ofs dbg; newval], dbg)
745745
let float_array_set arr ofs newval dbg =
746-
Cop(Cstore (Double_u, Lambda.Assignment),
746+
Cop(Cstore (Double, Lambda.Assignment),
747747
[array_indexing log2_size_float arr ofs dbg; newval], dbg)
748748

749749
(* String length *)
@@ -2094,7 +2094,7 @@ let generic_functions shared units =
20942094
type unary_primitive = expression -> Debuginfo.t -> expression
20952095

20962096
let floatfield n ptr dbg =
2097-
Cop(Cload (Double_u, Mutable),
2097+
Cop(Cload (Double, Mutable),
20982098
[if n = 0 then ptr
20992099
else Cop(Cadda, [ptr; Cconst_int(n * size_float, dbg)], dbg)],
21002100
dbg)
@@ -2198,7 +2198,7 @@ let setfield n ptr init arg1 arg2 dbg =
21982198

21992199
let setfloatfield n init arg1 arg2 dbg =
22002200
return_unit dbg (
2201-
Cop(Cstore (Double_u, init),
2201+
Cop(Cstore (Double, init),
22022202
[if n = 0 then arg1
22032203
else Cop(Cadda, [arg1; Cconst_int(n * size_float, dbg)], dbg);
22042204
arg2], dbg))

asmcomp/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

asmcomp/i386/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ let emit_instr fallthrough i =
582582
I.movsx (addressing addr WORD i 0) (reg dest)
583583
| Single ->
584584
I.fld (addressing addr REAL4 i 0)
585-
| Double | Double_u ->
585+
| Double ->
586586
I.fld (addressing addr REAL8 i 0)
587587
end
588588
| Lop(Istore(chunk, addr, _)) ->
@@ -600,7 +600,7 @@ let emit_instr fallthrough i =
600600
I.fld (reg i.arg.(0));
601601
I.fstp (addressing addr REAL4 i 1)
602602
end
603-
| Double | Double_u ->
603+
| Double ->
604604
if is_tos i.arg.(0) then
605605
I.fstp (addressing addr REAL8 i 1)
606606
else begin

asmcomp/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

asmcomp/power/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ let emit_instr i =
740740
| Thirtytwo_signed -> if ppc64 then "lwa" else "lwz"
741741
| Word_int | Word_val -> lg
742742
| Single -> "lfs"
743-
| Double | Double_u -> "lfd" in
743+
| Double -> "lfd" in
744744
emit_load_store loadinstr addr i.arg 0 i.res.(0);
745745
if chunk = Byte_signed then
746746
` extsb {emit_reg i.res.(0)}, {emit_reg i.res.(0)}\n`
@@ -752,7 +752,7 @@ let emit_instr i =
752752
| Thirtytwo_unsigned | Thirtytwo_signed -> "stw"
753753
| Word_int | Word_val -> stg
754754
| Single -> "stfs"
755-
| Double | Double_u -> "stfd" in
755+
| Double -> "stfd" in
756756
emit_load_store storeinstr addr i.arg 1 i.arg.(0)
757757
| Lop(Ialloc { bytes = n; dbginfo }) ->
758758
if !call_gc_label = 0 then call_gc_label := new_label ();

asmcomp/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

asmcomp/riscv/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ let emit_instr i =
351351
| Thirtytwo_signed -> "lw"
352352
| Word_int | Word_val -> "ld"
353353
| Single -> assert false
354-
| Double | Double_u -> "fld"
354+
| Double -> "fld"
355355
in
356356
` {emit_string instr} {emit_reg i.res.(0)}, {emit_int ofs}({emit_reg i.arg.(0)})\n`
357357
| Lop(Istore(Single, Iindexed ofs, _)) ->
@@ -366,7 +366,7 @@ let emit_instr i =
366366
| Thirtytwo_unsigned | Thirtytwo_signed -> "sw"
367367
| Word_int | Word_val -> "sd"
368368
| Single -> assert false
369-
| Double | Double_u -> "fsd"
369+
| Double -> "fsd"
370370
in
371371
` {emit_string instr} {emit_reg i.arg.(0)}, {emit_int ofs}({emit_reg i.arg.(1)})\n`
372372
| Lop(Ialloc {bytes; dbginfo}) ->

asmcomp/s390x/emit.mlp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ let emit_instr i =
401401
| Thirtytwo_signed -> "lgf"
402402
| Word_int | Word_val -> "lg"
403403
| Single -> "ley"
404-
| Double | Double_u -> "ldy" in
404+
| Double -> "ldy" in
405405
emit_load_store loadinstr addr i.arg 0 i.res.(0);
406406
if chunk = Single then
407407
` ldebr {emit_reg i.res.(0)}, {emit_reg i.res.(0)}\n`
@@ -417,7 +417,7 @@ let emit_instr i =
417417
| Thirtytwo_unsigned | Thirtytwo_signed -> "sty"
418418
| Word_int | Word_val -> "stg"
419419
| Single -> assert false
420-
| Double | Double_u -> "stdy" in
420+
| Double -> "stdy" in
421421
emit_load_store storeinstr addr i.arg 1 i.arg.(0)
422422

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

asmcomp/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
@@ -994,7 +994,7 @@ method emit_stores env data regs_addr =
994994
Istore(_, _, _) ->
995995
for i = 0 to Array.length regs - 1 do
996996
let r = regs.(i) in
997-
let kind = if r.typ = Float then Double_u else Word_val in
997+
let kind = if r.typ = Float then Double else Word_val in
998998
self#insert env
999999
(Iop(Istore(kind, !a, false)))
10001000
(Array.append [|r|] regs_addr) [||];

testsuite/tools/parsecmm.mly

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ expr:
271271
Debuginfo.none) }
272272
| LPAREN FLOATAREF expr expr RPAREN
273273
{ let open Asttypes in
274-
Cop(Cload (Double_u, Mutable), [access_array $3 $4 Arch.size_float],
274+
Cop(Cload (Double, Mutable), [access_array $3 $4 Arch.size_float],
275275
Debuginfo.none) }
276276
| LPAREN ADDRASET expr expr expr RPAREN
277277
{ let open Lambda in
@@ -283,7 +283,7 @@ expr:
283283
[access_array $3 $4 Arch.size_int; $5], Debuginfo.none) }
284284
| LPAREN FLOATASET expr expr expr RPAREN
285285
{ let open Lambda in
286-
Cop(Cstore (Double_u, Assignment),
286+
Cop(Cstore (Double, Assignment),
287287
[access_array $3 $4 Arch.size_float; $5], Debuginfo.none) }
288288
;
289289
exprlist:
@@ -323,7 +323,7 @@ chunk:
323323
| ADDR { Word_val }
324324
| FLOAT32 { Single }
325325
| FLOAT64 { Double }
326-
| FLOAT { Double_u }
326+
| FLOAT { Double }
327327
| VAL { Word_val }
328328
;
329329
unaryop:

0 commit comments

Comments
 (0)