From 5abd0529197507395b83fc44f1e1a6fb6ac0096e Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Sat, 4 May 2019 09:23:13 +0200 Subject: store o --- mppa_k1c/Peephole.v | 33 +++++++++++++++++++-------------- test/monniaux/picosat-965/Makefile | 4 ++-- test/monniaux/rules.mk | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/mppa_k1c/Peephole.v b/mppa_k1c/Peephole.v index 9fb0d898..81f0dc82 100644 --- a/mppa_k1c/Peephole.v +++ b/mppa_k1c/Peephole.v @@ -50,6 +50,8 @@ Definition gpreg_o_search r0 r1 r2 r3 : option gpreg_o := Parameter print_found_store: forall A, Z -> A -> A. +Definition coalesce_octuples := true. + Fixpoint coalesce_mem (insns : list basic) : list basic := match insns with | nil => nil @@ -65,21 +67,24 @@ Fixpoint coalesce_mem (insns : list basic) : list basic := let zofs1 := Ptrofs.signed ofs1 in if (zofs1 =? zofs0 + 8) && (ireg_eq ra0 ra1) then - match t1 with - | (PStoreRRO Psd_a rs2 ra2 ofs2) :: - (PStoreRRO Psd_a rs3 ra3 ofs3) :: t3 => - match gpreg_o_search rs0 rs1 rs2 rs3 with - | Some octuple => - let zofs2 := Ptrofs.signed ofs2 in - let zofs3 := Ptrofs.signed ofs3 in - if (zofs2 =? zofs0 + 16) && (ireg_eq ra0 ra2) && - (zofs3 =? zofs0 + 24) && (ireg_eq ra0 ra3) - then (PStore (PStoreORRO octuple ra0 ofs0)) :: Pnop :: Pnop :: Pnop :: (coalesce_mem t3) - else (PStore (PStoreQRRO rs0rs1 ra0 ofs0)) :: Pnop :: (coalesce_mem t1) - | None => (PStore (PStoreQRRO rs0rs1 ra0 ofs0)) :: Pnop :: (coalesce_mem t1) + if coalesce_octuples + then + match t1 with + | (PStoreRRO Psd_a rs2 ra2 ofs2) :: + (PStoreRRO Psd_a rs3 ra3 ofs3) :: t3 => + match gpreg_o_search rs0 rs1 rs2 rs3 with + | Some octuple => + let zofs2 := Ptrofs.signed ofs2 in + let zofs3 := Ptrofs.signed ofs3 in + if (zofs2 =? zofs0 + 16) && (ireg_eq ra0 ra2) && + (zofs3 =? zofs0 + 24) && (ireg_eq ra0 ra3) + then (PStore (PStoreORRO octuple ra0 ofs0)) :: Pnop :: Pnop :: Pnop :: (coalesce_mem t3) + else (PStore (PStoreQRRO rs0rs1 ra0 ofs0)) :: Pnop :: (coalesce_mem t1) + | None => (PStore (PStoreQRRO rs0rs1 ra0 ofs0)) :: Pnop :: (coalesce_mem t1) + end + | _ => (PStore (PStoreQRRO rs0rs1 ra0 ofs0)) :: Pnop :: (coalesce_mem t1) end - | _ => (PStore (PStoreQRRO rs0rs1 ra0 ofs0)) :: Pnop :: (coalesce_mem t1) - end + else (PStore (PStoreQRRO rs0rs1 ra0 ofs0)) :: Pnop :: (coalesce_mem t1) else h0 :: (coalesce_mem t0) | None => h0 :: (coalesce_mem t0) end diff --git a/test/monniaux/picosat-965/Makefile b/test/monniaux/picosat-965/Makefile index 6a7fadc7..d3322bcb 100644 --- a/test/monniaux/picosat-965/Makefile +++ b/test/monniaux/picosat-965/Makefile @@ -2,8 +2,8 @@ EXECUTE_ARGS=sudoku.sat include ../rules.mk -ALL_CFLAGS = -DNDEBUG -EMBEDDED_CFLAGS = -DNALARM -DNZIP -DNGETRUSAGE +#ALL_CFLAGS = -DNDEBUG +ALL_CFLAGS = -DNALARM -DNZIP -DNGETRUSAGE -DNDEBUG K1C_CFLAGS += $(EMBEDDED_CFLAGS) K1C_CCOMPFLAGS += $(EMBEDDED_CFLAGS) CCOMPFLAGS += -fbitfields diff --git a/test/monniaux/rules.mk b/test/monniaux/rules.mk index d098d1b2..ffbdac96 100644 --- a/test/monniaux/rules.mk +++ b/test/monniaux/rules.mk @@ -1,5 +1,5 @@ ALL_CCOMPFLAGS=-fno-unprototyped -CCOMP=ccomp-x86 +CCOMP=ccomp CCOMPFLAGS=-g -O3 -Wall $(ALL_CCOMPFLAGS) $(ALL_CFLAGS) CFLAGS=-g -std=c99 -O3 -Wall -Wextra -Werror=implicit $(ALL_CFLAGS) -- cgit