[PATCH,RFC] Re: [test-suite] / [LNT] debugging the handling of -maltivec in SingleSource/UnitTests/Vector/Altivec/Makefile

Daniel Dunbar daniel at zuster.org
Thu Feb 7 11:42:57 PST 2013


On Thu, Feb 7, 2013 at 7:03 AM, Will Schmidt <will_schmidt at vnet.ibm.com>wrote:

> On Wed, 2013-02-06 at 18:02 -0800, Daniel Dunbar wrote:
> > Hi Will,
> >
> >
> > The reason TARGET_FLAGS doesn't stick is because LNT sets it
> > specifically on the make command line (and that overrides other uses).
> >
> >
> > Interestingly, Makefile.tests (at the top-level) actually introduces
> > an X_TARGET_FLAGS to work around this, but it doesn't look like the
> > MultiSource or SingleSource makefiles do the same thing. The right fix
> > is probably to do the same thing Makefile.tests is doing in each of
> > those places.
>
> Thanks for the comments.  So with that suggestion, how about the
> following?
>

Thanks for working on it, one suggestion inline...


>
> This fixes an issue with the -maltivec flag not being passed to the
> build rules, which is affecting the powerpc64 LNT buildbots.
>
> Add X_TARGET_FLAGS makefile variable to MultiSource/Makefile.multisrc
> and SingleSource/Makefile.singlesource.  Change TARGET_FLAGS references
> within each to X_TARGET_FLAGS, allowing better function within the LNT
> environment.
>
> Update SingleSource/UnitTests/Vector/Altivec/Makefile to use
> TEST_TARGET_FLAGS to pass the -maltivec flag to build rules.
>
>
>
> Index: MultiSource/Makefile.multisrc
> ===================================================================
> --- MultiSource/Makefile.multisrc       (revision 174514)
> +++ MultiSource/Makefile.multisrc       (working copy)
> @@ -18,6 +18,9 @@
>
>  include $(LEVEL)/Makefile.programs
>
> +# use X_TARGET_FLAGS to work around LNT behavior.
>

It doesn't really have anything to do with LNT behavior, its make behavior.
Probably better to just take the same comment from Makefile.tests.

Actually, this variable definition should probably just get lifted to
Makefile.programs, and then removed from all the other places.

 - Daniel

+X_TARGET_FLAGS = $(TARGET_FLAGS) $(TEST_TARGET_FLAGS)
> +
>  # Figure out what object files we want to build...
>  LObjs    := $(sort $(addsuffix .bc, $(notdir $(basename $(Source)))))
>  LObjects := $(addprefix Output/,$(LObjs))
> @@ -31,35 +34,35 @@
>  .PRECIOUS: $(LObjects) $(NObjects) $(NLObjects)
>
>  Output/%.o: %.c Output/.dir
> -       -$(CC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c $< -o
> $@
> +       -$(CC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c $<
> -o $@
>
>  Output/%.o: %.C Output/.dir
> -       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c $<
> -o $@
> +       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>
>  Output/%.o: %.cpp Output/.dir
> -       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c $<
> -o $@
> +       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>
>  Output/%.o: %.cc Output/.dir
> -       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c $<
> -o $@
> +       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>
>  Output/%.llvm.o: %.c Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c $<
> -o $@
> +         $(LCC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c $<
> -o $@
>  Output/%.llvm.o: %.m Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c $<
> -o $@
> +         $(LCC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c $<
> -o $@
>  Output/%.llvm.o: %.C Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c
> $< -o $@
> +         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>  Output/%.llvm.o: %.cpp Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c
> $< -o $@
> +         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>  Output/%.llvm.o: %.cc Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c
> $< -o $@
> +         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>  Output/%.llvm.o: %.mm Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c
> $< -o $@
> +         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>
>  bugpoint-opt: Output/$(PROG).bugpoint-opt
>  bugpoint-gccas: Output/$(PROG).bugpoint-opt
> @@ -89,10 +92,10 @@
>  /^user/ { user += $$2; }\
>  /^sys/ { sys += $$2; }\
>  END { printf("real %f\nuser %f\nsys %f\n", real, user, sys); }' >
> $@.compile.time
> -       -$(LD_ENV_OVERRIDES) $(LCXX) -o $@ $(NLObjects) $(LDFLAGS)
> $(CFLAGS) $(TARGET_FLAGS)
> +       -$(LD_ENV_OVERRIDES) $(LCXX) -o $@ $(NLObjects) $(LDFLAGS)
> $(CFLAGS) $(X_TARGET_FLAGS)
>
>  Output/%.native: $(NObjects) $(GeneratedTestInputs)
> -       -$(CXX) -o $@ $(NObjects) $(LDFLAGS) $(CFLAGS) $(TARGET_FLAGS)
> +       -$(CXX) -o $@ $(NObjects) $(LDFLAGS) $(CFLAGS) $(X_TARGET_FLAGS)
>
>  # A simple target to run findmisopt when bugpoint isn't helping
>  findmisopt:
> Index: SingleSource/Makefile.singlesrc
> ===================================================================
> --- SingleSource/Makefile.singlesrc     (revision 174514)
> +++ SingleSource/Makefile.singlesrc     (working copy)
> @@ -36,6 +36,10 @@
>         $(patsubst $(SourceDir)%,%,$(basename $(Source))))
>
>  include $(LEVEL)/Makefile.programs
> +
> +# use X_TARGET_FLAGS to work around LNT behavior.
> +X_TARGET_FLAGS = $(TARGET_FLAGS) $(TEST_TARGET_FLAGS)
> +
>  .PRECIOUS: Output/%.linked.rll
>
>  ifndef USE_PRECOMPILED_BYTECODE
> @@ -57,88 +61,88 @@
>
>  Output/%.llvm.o: %.c Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c $<
> -o $@
> +         $(LCC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c $<
> -o $@
>  Output/%.llvm.o: %.m Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c $<
> -o $@
> +         $(LCC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c $<
> -o $@
>  Output/%.llvm.o: %.C Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c
> $< -o $@
> +         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>  Output/%.llvm.o: %.cpp Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c
> $< -o $@
> +         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>  Output/%.llvm.o: %.cc Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c
> $< -o $@
> +         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>  Output/%.llvm.o: %.mm Output/.dir
>         $(RUNSAFELYLOCAL) /dev/null $@.compile \
> -         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) -c
> $< -o $@
> +         $(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) -c
> $< -o $@
>  .PRECIOUS: Output/%.llvm.o
>
>  Output/%.simple: Output/%.llvm.o Output/.dir
>         -$(CP) $<.compile.time $@.compile.time
> -       -$(LD_ENV_OVERRIDES) $(LCXX) -o $@ $< $(LDFLAGS) $(CFLAGS)
> $(TARGET_FLAGS)
> +       -$(LD_ENV_OVERRIDES) $(LCXX) -o $@ $< $(LDFLAGS) $(CFLAGS)
> $(X_TARGET_FLAGS)
>
>  # FIXME: LIBS should be specified, not hardcoded to -lm
>  Output/%.native: $(SourceDir)/%.c Output/.dir
> -       -$(CC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $< -lm -o
> $@ $(LDFLAGS)
> +       -$(CC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) $< -lm
> -o $@ $(LDFLAGS)
>
>  Output/%.native: $(SourceDir)/%.cpp Output/.dir
> -       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $< -lm
> -o $@ $(LDFLAGS)
> +       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
>
>  Output/%.native: $(SourceDir)/%.m Output/.dir
> -       -$(CC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $< -lm -o
> $@ $(LDFLAGS)
> +       -$(CC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) $< -lm
> -o $@ $(LDFLAGS)
>
>  Output/%.native: $(SourceDir)/%.mm Output/.dir
> -       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $< -lm
> -o $@ $(LDFLAGS)
> +       -$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
>
>  Output/%.native.dbg: $(SourceDir)/%.c Output/.dir
> -       -$(CC) -g $(CPPFLAGS) $(CFLAGS) $(TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
> +       -$(CC) -g $(CPPFLAGS) $(CFLAGS) $(X_TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
>
>  Output/%.native.dbg: $(SourceDir)/%.cpp Output/.dir
> -       -$(CXX) -g $(CPPFLAGS) $(CXXFLAGS) $(TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
> +       -$(CXX) -g $(CPPFLAGS) $(CXXFLAGS) $(X_TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
>
>  Output/%.native.dbg: $(SourceDir)/%.m Output/.dir
> -       -$(CC) -g $(CPPFLAGS) $(CFLAGS) $(TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
> +       -$(CC) -g $(CPPFLAGS) $(CFLAGS) $(X_TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
>
>  Output/%.native.dbg: $(SourceDir)/%.mm Output/.dir
> -       -$(CXX) -g $(CPPFLAGS) $(CXXFLAGS) $(TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
> +       -$(CXX) -g $(CPPFLAGS) $(CXXFLAGS) $(X_TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
>
>  Output/%.native.dbg.opt: $(SourceDir)/%.c Output/.dir
> -       -$(CC) -g $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $< -lm
> -o $@ $(LDFLAGS)
> +       -$(CC) -g $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
>
>  Output/%.native.dbg.opt: $(SourceDir)/%.cpp Output/.dir
> -       -$(CXX) -g $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
> +       -$(CXX) -g $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS)
> $< -lm -o $@ $(LDFLAGS)
>
>  Output/%.native.dbg.opt: $(SourceDir)/%.m Output/.dir
> -       -$(CC) -g $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $< -lm
> -o $@ $(LDFLAGS)
> +       -$(CC) -g $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
>
>  Output/%.native.dbg.opt: $(SourceDir)/%.mm Output/.dir
> -       -$(CXX) -g $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
> +       -$(CXX) -g $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS)
> $< -lm -o $@ $(LDFLAGS)
>
>  Output/%.dbg: $(SourceDir)/%.c Output/.dir
> -       -$(LCC) -g $(CPPFLAGS) $(CFLAGS) $(TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
> +       -$(LCC) -g $(CPPFLAGS) $(CFLAGS) $(X_TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
>
>  Output/%.dbg: $(SourceDir)/%.cpp Output/.dir
> -       -$(LCXX) -g $(CPPFLAGS) $(CXXFLAGS) $(TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
> +       -$(LCXX) -g $(CPPFLAGS) $(CXXFLAGS) $(X_TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
>
>  Output/%.dbg: $(SourceDir)/%.m Output/.dir
> -       -$(LCC) -g $(CPPFLAGS) $(CFLAGS) $(TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
> +       -$(LCC) -g $(CPPFLAGS) $(CFLAGS) $(X_TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
>
>  Output/%.dbg: $(SourceDir)/%.mm Output/.dir
> -       -$(LCXX) -g $(CPPFLAGS) $(CXXFLAGS) $(TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
> +       -$(LCXX) -g $(CPPFLAGS) $(CXXFLAGS) $(X_TARGET_FLAGS) $< -lm -o $@
> $(LDFLAGS)
>
>  Output/%.dbg.opt: $(SourceDir)/%.c Output/.dir
> -       -$(LCC) -g $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
> +       -$(LCC) -g $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
>
>  Output/%.dbg.opt: $(SourceDir)/%.cpp Output/.dir
> -       -$(LCXX) -g $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
> +       -$(LCXX) -g $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS)
> $< -lm -o $@ $(LDFLAGS)
>
>  Output/%.dbg.opt: $(SourceDir)/%.m Output/.dir
> -       -$(LCC) -g $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
> +       -$(LCC) -g $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
>
>  Output/%.dbg.opt: $(SourceDir)/%.mm Output/.dir
> -       -$(LCXX) -g $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $<
> -lm -o $@ $(LDFLAGS)
> +       -$(LCXX) -g $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(X_TARGET_FLAGS)
> $< -lm -o $@ $(LDFLAGS)
>
>  bugpoint-gccas bugpoint-opt bugpoint-jit bugpoint-llc bugpoint-llc-beta:
>         @echo "The $@ target doesn't work in SingleSource.  Try:"
> Index: SingleSource/UnitTests/Vector/Altivec/Makefile
> ===================================================================
> --- SingleSource/UnitTests/Vector/Altivec/Makefile      (revision 174514)
> +++ SingleSource/UnitTests/Vector/Altivec/Makefile      (working copy)
> @@ -9,6 +9,8 @@
>  FP_TOLERANCE := 0.002
>
>  TARGET_FLAGS += -maltivec
> +# also set TEST_TARGET_FLAGS for the LNT environment.
> +TEST_TARGET_FLAGS += -maltivec
>  LCCFLAGS += -maltivec
>
>  include $(LEVEL)/SingleSource/Makefile.singlesrc
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130207/6b4039af/attachment.html>


More information about the llvm-commits mailing list