[qfcc] Add a failing test for v6 inout params

Getting the vector literal compiling proved to be interesting.
This commit is contained in:
Bill Currie 2024-09-03 20:21:25 +09:00
parent 291f920e2a
commit 0c24f436ae
3 changed files with 67 additions and 9 deletions

View file

@ -102,21 +102,25 @@ QCOMPILE=$(QFCC) $(QCFLAGS) $(QCPPFLAGS)
QLINK=$(QFCC) $(QCFLAGS) $(QCLINKFLAGS)
MKDIR_P = @MKDIR_P@
qfcc_compile=\
$(V_QFCC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
$(QCOMPILE) $(1) -MT $@ -MD -MP -MF $$depbase.Tqo -c -o $@ $< &&\
sed -i -e '1s@:@: $(QFCC_DEP)@' $$depbase.Tqo &&\
$(am__mv) $$depbase.Tqo $$depbase.Qo
am__mv = mv -f
SUFFIXES=.o .r .pas
%_v6p.o: %.r
$(call qfcc_compile,-Ctarget=v6p)
%_v6.o: %.r
$(call qfcc_compile,-Ctarget=v6)
.r.o:
$(V_QFCC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
$(QCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tqo -c -o $@ $< &&\
sed -i -e '1s@:@: $(QFCC_DEP)@' $$depbase.Tqo &&\
$(am__mv) $$depbase.Tqo $$depbase.Qo
$(qfcc_compile)
.pas.o:
$(V_QFCC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
$(QCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tqo -c -o $@ $< &&\
sed -i -e '1s@:@: $(QFCC_DEP)@' $$depbase.Tqo &&\
$(am__mv) $$depbase.Tqo $$depbase.Qo
$(qfcc_compile)
qcautodep = $(join $(addsuffix $(DEPDIR)/,$(dir $(basename $(1)))),$(addsuffix .Qo,$(notdir $(basename $(basename $(1))))))
qcautodep = $(join $(addsuffix $(DEPDIR)/,$(dir $(basename $(1)))),$(addsuffix $(2).Qo,$(notdir $(basename $(basename $(1))))))
r_depfiles_remade=
pas_depfiles_remade=

View file

@ -37,6 +37,9 @@ test_progs_dat=\
tools/qfcc/test/gcd.dat \
tools/qfcc/test/ifsuper.dat \
tools/qfcc/test/infloop.dat \
tools/qfcc/test/inout.dat \
tools/qfcc/test/inout_v6.dat \
tools/qfcc/test/inout_v6p.dat \
tools/qfcc/test/iterfunc.dat \
tools/qfcc/test/ivar-struct-return.dat \
tools/qfcc/test/link_order.dat \
@ -493,6 +496,36 @@ tools/qfcc/test/infloop.run: $(qfcc_test_run_deps)
include $(infloop_dep) # am--include-marker
r_depfiles_remade += $(infloop_dep)
tools_qfcc_test_inout_dat_SOURCES=tools/qfcc/test/inout.r
inout_obj=$(tools_qfcc_test_inout_dat_SOURCES:.r=.o)
inout_dep=$(call qcautodep,$(tools_qfcc_test_inout_dat_SOURCES))
tools/qfcc/test/inout.dat$(EXEEXT): $(inout_obj) $(QFCC_DEP)
$(V_QFCCLD)$(QLINK) -o $@ $(inout_obj)
tools/qfcc/test/inout.run: $(qfcc_test_run_deps)
@TEST_HARNESS_OPTS=--float $(top_srcdir)/tools/qfcc/test/build-run $@
include $(inout_dep) # am--include-marker
r_depfiles_remade += $(inout_dep)
tools_qfcc_test_inout_v6_dat_SOURCES=tools/qfcc/test/inout.r
inout_v6_obj=$(tools_qfcc_test_inout_v6_dat_SOURCES:.r=_v6.o)
inout_v6_dep=$(call qcautodep,$(tools_qfcc_test_inout_v6_dat_SOURCES,_v6))
tools/qfcc/test/inout_v6.dat$(EXEEXT): $(inout_v6_obj) $(QFCC_DEP)
$(V_QFCCLD)$(QLINK) -Ctarget=v6 -o $@ $(inout_v6_obj)
tools/qfcc/test/inout_v6.run: $(qfcc_test_run_deps)
@TEST_HARNESS_OPTS=--float $(top_srcdir)/tools/qfcc/test/build-run $@
include $(inout_v6_dep) # am--include-marker
r_depfiles_remade += $(inout_v6_dep)
tools_qfcc_test_inout_v6p_dat_SOURCES=tools/qfcc/test/inout.r
inout_v6p_obj=$(tools_qfcc_test_inout_v6p_dat_SOURCES:.r=_v6p.o)
inout_v6p_dep=$(call qcautodep,$(tools_qfcc_test_inout_v6p_dat_SOURCES,_v6p))
tools/qfcc/test/inout_v6p.dat$(EXEEXT): $(inout_v6p_obj) $(QFCC_DEP)
$(V_QFCCLD)$(QLINK) -Ctarget=v6p -o $@ $(inout_v6p_obj)
tools/qfcc/test/inout_v6p.run: $(qfcc_test_run_deps)
@TEST_HARNESS_OPTS=--float $(top_srcdir)/tools/qfcc/test/build-run $@
include $(inout_v6p_dep) # am--include-marker
r_depfiles_remade += $(inout_v6p_dep)
tools_qfcc_test_iterfunc_dat_SOURCES=tools/qfcc/test/iterfunc.r
iterfunc_obj=$(tools_qfcc_test_iterfunc_dat_SOURCES:.r=.o)
iterfunc_dep=$(call qcautodep,$(tools_qfcc_test_iterfunc_dat_SOURCES))

21
tools/qfcc/test/inout.r Normal file
View file

@ -0,0 +1,21 @@
float project (vector a, vector b, @out vector p)
{
float d = a @dot b / b @dot b;
p = a - d * b;
return d;
}
void printf (string fmt, ...) = #0;
float
main ()
{
vector a = '1 3 2';
vector b = '4 0 3';
vector c;
float d = project (a, b, c) != 0.4;
printf ("%.9v\n", c);
if (c != '-0.6 3 0.799999952')
d = 1;
return d;
}