From dff22ef6d855973e0e0f05c7203a6bfa9a4cf01a Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Thu, 15 Jun 2017 15:11:26 +0200 Subject: Extend builtin arguments with a pointer addition operator This extension enables more addressing modes to be encoded as builtin arguments and used in conjunction with volatile memory accesses. Current status: x86 port only, the only new addressing mode handled is reg + offset. --- test/regression/Makefile | 2 +- test/regression/Results/volatile4 | 5 +++++ test/regression/volatile4.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/regression/Results/volatile4 create mode 100644 test/regression/volatile4.c (limited to 'test') diff --git a/test/regression/Makefile b/test/regression/Makefile index 54745863..25b47c7e 100644 --- a/test/regression/Makefile +++ b/test/regression/Makefile @@ -10,7 +10,7 @@ LIBS=$(LIBMATH) TESTS=int32 int64 floats floats-basics \ expr1 expr6 funptr2 initializers initializers2 initializers3 \ - volatile1 volatile2 volatile3 \ + volatile1 volatile2 volatile3 volatile4 \ funct3 expr5 struct7 struct8 struct11 struct12 casts1 casts2 char1 \ sizeof1 sizeof2 binops bool for1 switch switch2 compound \ decl1 interop1 bitfields9 ptrs3 \ diff --git a/test/regression/Results/volatile4 b/test/regression/Results/volatile4 new file mode 100644 index 00000000..e650a8e5 --- /dev/null +++ b/test/regression/Results/volatile4 @@ -0,0 +1,5 @@ +l = 42 +a[5] = 255 +g = 3 +b[2] = -1 +p[1] = 80 diff --git a/test/regression/volatile4.c b/test/regression/volatile4.c new file mode 100644 index 00000000..b72e1bb9 --- /dev/null +++ b/test/regression/volatile4.c @@ -0,0 +1,29 @@ +/* Addressing modes in volatiles */ + +#include + +volatile int g = 1; +volatile int b[10]; + +void test1(volatile int * p) +{ + volatile int l; + volatile int a[10]; + + l = 42; + printf ("l = %d\n", l); + a[5] = 0xff; + printf ("a[5] = %d\n", a[5]); + g = 3; + printf ("g = %d\n", g); + b[2] = -1; + printf ("b[2] = %d\n", b[2]); + p[1] = 80; + printf ("p[1] = %d\n", p[1]); +} + +int main() +{ + test1(&b[0]); + return 0; +} -- cgit