Re: [PATCH] kbuild: use ?= to assign CROSS_COMPILE by arch-Makefile
Hi Yamada-san, On Sun, Apr 11, 2021 at 3:56 PM Masahiro Yamada wrote: > Use ?= operator to let arch/*/Makefile to assign CROSS_COMPILE only > when CROSS_COMPILE is undefined. > > This allows arch-Makefiles to drop the ifeq ($(CROSS_COMPILE),) > conditional. > > This slightly changes the behavior; the arch-Makefile previously > overrode CROSS_COMPILE when CROSS_COMPILE has already been made empty > via an environment variable as in 'export CROSS_COMPILE='. > > With this commit, arch-Makefle will respect the user's environment > set-up, which seems to be a more correct behavior. > > Signed-off-by: Masahiro Yamada Thanks for your patch! > --- > > arch/arc/Makefile| 4 +--- > arch/h8300/Makefile | 4 +--- > arch/m68k/Makefile | 4 +--- > arch/mips/Makefile | 4 +--- > arch/parisc/Makefile | 6 ++ > arch/sh/Makefile | 4 +--- What about arch/xtensa/Makefile? > --- a/arch/m68k/Makefile > +++ b/arch/m68k/Makefile > @@ -17,10 +17,8 @@ > KBUILD_DEFCONFIG := multi_defconfig > > ifneq ($(SUBARCH),$(ARCH)) > - ifeq ($(CROSS_COMPILE),) > - CROSS_COMPILE := $(call cc-cross-prefix, \ > + CROSS_COMPILE ?= $(call cc-cross-prefix, \ > m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-) > - endif > endif This does not seem to work as expected: my standard build scripts (using "make ARCH=m68k") no longer pick up the cross-compiler, but fall back to the native compiler, thus breaking the build. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH] kbuild: use ?= to assign CROSS_COMPILE by arch-Makefile
On Mon, Apr 12, 2021 at 4:44 PM Geert Uytterhoeven wrote: > > Hi Yamada-san, > > On Sun, Apr 11, 2021 at 3:56 PM Masahiro Yamada wrote: > > Use ?= operator to let arch/*/Makefile to assign CROSS_COMPILE only > > when CROSS_COMPILE is undefined. > > > > This allows arch-Makefiles to drop the ifeq ($(CROSS_COMPILE),) > > conditional. > > > > This slightly changes the behavior; the arch-Makefile previously > > overrode CROSS_COMPILE when CROSS_COMPILE has already been made empty > > via an environment variable as in 'export CROSS_COMPILE='. > > > > With this commit, arch-Makefle will respect the user's environment > > set-up, which seems to be a more correct behavior. > > > > Signed-off-by: Masahiro Yamada > > Thanks for your patch! > > > --- > > > > arch/arc/Makefile| 4 +--- > > arch/h8300/Makefile | 4 +--- > > arch/m68k/Makefile | 4 +--- > > arch/mips/Makefile | 4 +--- > > arch/parisc/Makefile | 6 ++ > > arch/sh/Makefile | 4 +--- > > What about arch/xtensa/Makefile? > > > --- a/arch/m68k/Makefile > > +++ b/arch/m68k/Makefile > > @@ -17,10 +17,8 @@ > > KBUILD_DEFCONFIG := multi_defconfig > > > > ifneq ($(SUBARCH),$(ARCH)) > > - ifeq ($(CROSS_COMPILE),) > > - CROSS_COMPILE := $(call cc-cross-prefix, \ > > + CROSS_COMPILE ?= $(call cc-cross-prefix, \ > > m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-) > > - endif > > endif > > This does not seem to work as expected: my standard build scripts > (using "make ARCH=m68k") no longer pick up the cross-compiler, > but fall back to the native compiler, thus breaking the build. Agh, sorry, this patch does not work because the top Makefile exports CROSS_COMPILE. export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC Removing CROSS_COMPILE from that makes ?= work, but it would break other parts. Please ignore this patch. > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- > ge...@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like > that. > -- Linus Torvalds -- Best Regards Masahiro Yamada ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH] kbuild: use ?= to assign CROSS_COMPILE by arch-Makefile
On Mon, Apr 12, 2021 at 5:15 PM Masahiro Yamada wrote: > > On Mon, Apr 12, 2021 at 4:44 PM Geert Uytterhoeven > wrote: > > > > Hi Yamada-san, > > > > On Sun, Apr 11, 2021 at 3:56 PM Masahiro Yamada > > wrote: > > > Use ?= operator to let arch/*/Makefile to assign CROSS_COMPILE only > > > when CROSS_COMPILE is undefined. > > > > > > This allows arch-Makefiles to drop the ifeq ($(CROSS_COMPILE),) > > > conditional. > > > > > > This slightly changes the behavior; the arch-Makefile previously > > > overrode CROSS_COMPILE when CROSS_COMPILE has already been made empty > > > via an environment variable as in 'export CROSS_COMPILE='. > > > > > > With this commit, arch-Makefle will respect the user's environment > > > set-up, which seems to be a more correct behavior. > > > > > > Signed-off-by: Masahiro Yamada > > > > Thanks for your patch! > > > > > --- > > > > > > arch/arc/Makefile| 4 +--- > > > arch/h8300/Makefile | 4 +--- > > > arch/m68k/Makefile | 4 +--- > > > arch/mips/Makefile | 4 +--- > > > arch/parisc/Makefile | 6 ++ > > > arch/sh/Makefile | 4 +--- > > > > What about arch/xtensa/Makefile? > > > > > --- a/arch/m68k/Makefile > > > +++ b/arch/m68k/Makefile > > > @@ -17,10 +17,8 @@ > > > KBUILD_DEFCONFIG := multi_defconfig > > > > > > ifneq ($(SUBARCH),$(ARCH)) > > > - ifeq ($(CROSS_COMPILE),) > > > - CROSS_COMPILE := $(call cc-cross-prefix, \ > > > + CROSS_COMPILE ?= $(call cc-cross-prefix, \ > > > m68k-linux-gnu- m68k-linux- > > > m68k-unknown-linux-gnu-) > > > - endif > > > endif > > > > This does not seem to work as expected: my standard build scripts > > (using "make ARCH=m68k") no longer pick up the cross-compiler, > > but fall back to the native compiler, thus breaking the build. > > > Agh, sorry, this patch does not work > because the top Makefile exports CROSS_COMPILE. > > export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS > CROSS_COMPILE LD CC > > > > Removing CROSS_COMPILE from that makes ?= work, > but it would break other parts. > > > Please ignore this patch. > > > > > > Gr{oetje,eeting}s, > > > > Geert > > > > -- > > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- > > ge...@linux-m68k.org > > > > In personal conversations with technical people, I call myself a hacker. But > > when I'm talking to journalists I just say "programmer" or something like > > that. > > -- Linus Torvalds > The following will make this patch work, but probably it is better to not do this... diff --git a/Makefile b/Makefile index cc77fd45ca64..26bf482f0d88 100644 --- a/Makefile +++ b/Makefile @@ -506,7 +506,7 @@ KBUILD_LDFLAGS_MODULE := KBUILD_LDFLAGS := CLANG_FLAGS := -export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC +export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD @@ -681,6 +681,8 @@ export RETPOLINE_VDSO_CFLAGS include arch/$(SRCARCH)/Makefile +export CROSS_COMPILE + ifdef need-config ifdef may-sync-config # Read in dependencies to all Kconfig* files, make sure to run syncconfig if -- Best Regards Masahiro Yamada ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH AUTOSEL 5.11 10/51] arc: kernel: Return -EFAULT if copy_to_user() fails
From: Wang Qing [ Upstream commit 46e152186cd89d940b26726fff11eb3f4935b45a ] The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index a78d8f745a67..fdbe06c98895 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c @@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, sizeof(sf->uc.uc_mcontext.regs.scratch)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); - return err; + return err ? -EFAULT : 0; } static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) @@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) &(sf->uc.uc_mcontext.regs.scratch), sizeof(sf->uc.uc_mcontext.regs.scratch)); if (err) - return err; + return -EFAULT; set_current_blocked(&set); regs->bta = uregs.scratch.bta; -- 2.30.2 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH AUTOSEL 5.10 09/46] arc: kernel: Return -EFAULT if copy_to_user() fails
From: Wang Qing [ Upstream commit 46e152186cd89d940b26726fff11eb3f4935b45a ] The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index 2be55fb96d87..98e575dbcce5 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c @@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, sizeof(sf->uc.uc_mcontext.regs.scratch)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); - return err; + return err ? -EFAULT : 0; } static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) @@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) &(sf->uc.uc_mcontext.regs.scratch), sizeof(sf->uc.uc_mcontext.regs.scratch)); if (err) - return err; + return -EFAULT; set_current_blocked(&set); regs->bta = uregs.scratch.bta; -- 2.30.2 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH AUTOSEL 5.4 09/39] arc: kernel: Return -EFAULT if copy_to_user() fails
From: Wang Qing [ Upstream commit 46e152186cd89d940b26726fff11eb3f4935b45a ] The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index 3d57ed0d8535..404518051093 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c @@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, sizeof(sf->uc.uc_mcontext.regs.scratch)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); - return err; + return err ? -EFAULT : 0; } static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) @@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) &(sf->uc.uc_mcontext.regs.scratch), sizeof(sf->uc.uc_mcontext.regs.scratch)); if (err) - return err; + return -EFAULT; set_current_blocked(&set); regs->bta = uregs.scratch.bta; -- 2.30.2 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH AUTOSEL 4.19 05/28] arc: kernel: Return -EFAULT if copy_to_user() fails
From: Wang Qing [ Upstream commit 46e152186cd89d940b26726fff11eb3f4935b45a ] The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index 48685445002e..da243420bcb5 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c @@ -99,7 +99,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, sizeof(sf->uc.uc_mcontext.regs.scratch)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); - return err; + return err ? -EFAULT : 0; } static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) @@ -113,7 +113,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) &(sf->uc.uc_mcontext.regs.scratch), sizeof(sf->uc.uc_mcontext.regs.scratch)); if (err) - return err; + return -EFAULT; set_current_blocked(&set); regs->bta = uregs.scratch.bta; -- 2.30.2 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH AUTOSEL 4.14 03/25] arc: kernel: Return -EFAULT if copy_to_user() fails
From: Wang Qing [ Upstream commit 46e152186cd89d940b26726fff11eb3f4935b45a ] The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index 48685445002e..da243420bcb5 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c @@ -99,7 +99,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, sizeof(sf->uc.uc_mcontext.regs.scratch)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); - return err; + return err ? -EFAULT : 0; } static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) @@ -113,7 +113,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) &(sf->uc.uc_mcontext.regs.scratch), sizeof(sf->uc.uc_mcontext.regs.scratch)); if (err) - return err; + return -EFAULT; set_current_blocked(&set); regs->bta = uregs.scratch.bta; -- 2.30.2 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH AUTOSEL 4.9 03/23] arc: kernel: Return -EFAULT if copy_to_user() fails
From: Wang Qing [ Upstream commit 46e152186cd89d940b26726fff11eb3f4935b45a ] The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index d347bbc086fe..16cdb471d3db 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c @@ -97,7 +97,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, sizeof(sf->uc.uc_mcontext.regs.scratch)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); - return err; + return err ? -EFAULT : 0; } static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) @@ -111,7 +111,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) &(sf->uc.uc_mcontext.regs.scratch), sizeof(sf->uc.uc_mcontext.regs.scratch)); if (err) - return err; + return -EFAULT; set_current_blocked(&set); regs->bta = uregs.scratch.bta; -- 2.30.2 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
[PATCH AUTOSEL 4.4 03/23] arc: kernel: Return -EFAULT if copy_to_user() fails
From: Wang Qing [ Upstream commit 46e152186cd89d940b26726fff11eb3f4935b45a ] The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/kernel/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index 257b8699efde..639f39f39917 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c @@ -97,7 +97,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, sizeof(sf->uc.uc_mcontext.regs.scratch)); err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); - return err; + return err ? -EFAULT : 0; } static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) @@ -111,7 +111,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) &(sf->uc.uc_mcontext.regs.scratch), sizeof(sf->uc.uc_mcontext.regs.scratch)); if (err) - return err; + return -EFAULT; set_current_blocked(&set); regs->bta = uregs.scratch.bta; -- 2.30.2 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: *** ARC port for review ***
Hi Richard, Thanks for your quick reply. For the time, ARCv3 is an under development architecture and unfortunately, for the time being, there is no public documentation available. Please notice that this should be all available once ARCv3 gets released. QEMU ARCv3 port is really an early stage to prepare the ecosystem and we decided to include it in this patches to try to be as transparent as possible. Regards, Cupertino On 4/7/21 12:47 AM, Richard Henderson wrote: > On 4/5/21 7:31 AM, cupertinomira...@gmail.com wrote: >> In order to simplify the review process, we have separated the patches >> for ARCv3 from the previous emailed ARCv2 ones. Being the patches from >> 1 to 16 for ARCv2 and 17 to 27 for ARCv3. > > How may one find the arcv3 documentation on the synopsis website? > > The closest I can find is > > https://www.synopsys.com/designware-ip/processor-solutions.html > > which best I can figure leads to a paywall. > > > r~ ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH 07/27] arc: TCG instruction definitions
Hi Richard, I totally understand your position with a new scripting language and the unclean code produced by the auto generated tools. In order to ease out the review process, I propose to drop the idea of the generated code and cleanup by hand all of the semfunc.c functions. What is you opinion about this? Just to clarify my initial position: I agree that output code from my generation tools are far from optimal and way too verbose. First thing to improve would be to replace the temp_locals when possible. From my early experiments, I got the impression that TCG optimizer was not that bad and that hand optimized TCG would not be producing significantly better x86 code, except when using those temp_locals, obviously. My personal inclination, and initial thought, was that more verbose code would be acceptable. Also my perception, since I did not had the opportunity to dig into the TCG optimizer, was that TCG optimizer before being able to generate host code would need to decompose any TCG constructs into simpler forms and only then construct host machine code, and for that reason having more compact TCG code would be more of a code size optimization rather then a real improvement in final execution result. Answering also on the duplication from v2 and v3. I understand that duplication in general seems sloppy. However, please take into consideration that the semfunc.c, mapping and decoder code are generated or reused from binutils, did not seem to be so bad to keep them in the original form. Regards, Cupertino On 4/8/21 1:20 AM, Richard Henderson wrote: > On 4/5/21 7:31 AM, cupertinomira...@gmail.com wrote: >> +/* >> + * ADD >> + * Variables: @b, @c, @a >> + * Functions: getCCFlag, getFFlag, setZFlag, setNFlag, setCFlag, >> CarryADD, >> + * setVFlag, OverflowADD >> + * --- code --- >> + * { >> + * cc_flag = getCCFlag (); >> + * lb = @b; >> + * lc = @c; >> + * if((cc_flag == true)) >> + * { >> + * lb = @b; >> + * lc = @c; >> + * @a = (@b + @c); >> + * if((getFFlag () == true)) >> + * { >> + * setZFlag (@a); >> + * setNFlag (@a); >> + * setCFlag (CarryADD (@a, lb, lc)); >> + * setVFlag (OverflowADD (@a, lb, lc)); >> + * }; >> + * }; >> + * } >> + */ >> + >> +int >> +arc_gen_ADD(DisasCtxt *ctx, TCGv b, TCGv c, TCGv a) >> +{ >> + int ret = DISAS_NEXT; >> + TCGv temp_3 = tcg_temp_local_new(); >> + TCGv cc_flag = tcg_temp_local_new(); >> + TCGv lb = tcg_temp_local_new(); >> + TCGv lc = tcg_temp_local_new(); >> + TCGv temp_1 = tcg_temp_local_new(); >> + TCGv temp_2 = tcg_temp_local_new(); >> + TCGv temp_5 = tcg_temp_local_new(); >> + TCGv temp_4 = tcg_temp_local_new(); >> + TCGv temp_7 = tcg_temp_local_new(); >> + TCGv temp_6 = tcg_temp_local_new(); >> + getCCFlag(temp_3); >> + tcg_gen_mov_tl(cc_flag, temp_3); >> + tcg_gen_mov_tl(lb, b); >> + tcg_gen_mov_tl(lc, c); >> + TCGLabel *done_1 = gen_new_label(); >> + tcg_gen_setcond_tl(TCG_COND_EQ, temp_1, cc_flag, arc_true); >> + tcg_gen_xori_tl(temp_2, temp_1, 1); >> + tcg_gen_andi_tl(temp_2, temp_2, 1); >> + tcg_gen_brcond_tl(TCG_COND_EQ, temp_2, arc_true, done_1); >> + tcg_gen_mov_tl(lb, b); >> + tcg_gen_mov_tl(lc, c); >> + tcg_gen_add_tl(a, b, c); >> + if ((getFFlag () == true)) { >> + setZFlag(a); >> + setNFlag(a); >> + CarryADD(temp_5, a, lb, lc); >> + tcg_gen_mov_tl(temp_4, temp_5); >> + setCFlag(temp_4); >> + OverflowADD(temp_7, a, lb, lc); >> + tcg_gen_mov_tl(temp_6, temp_7); >> + setVFlag(temp_6); >> + } >> + gen_set_label(done_1); >> + tcg_temp_free(temp_3); >> + tcg_temp_free(cc_flag); >> + tcg_temp_free(lb); >> + tcg_temp_free(lc); >> + tcg_temp_free(temp_1); >> + tcg_temp_free(temp_2); >> + tcg_temp_free(temp_5); >> + tcg_temp_free(temp_4); >> + tcg_temp_free(temp_7); >> + tcg_temp_free(temp_6); >> + >> + return ret; >> +} > > I must say I'm not really impressed by the results here. > > Your input is clearly intended to be fed to an optimizing compiler, > which TCG is not. > > >> +/* >> + * DIV >> + * Variables: @src2, @src1, @dest >> + * Functions: getCCFlag, divSigned, getFFlag, setZFlag, setNFlag, >> setVFlag >> + * --- code --- >> + * { >> + * cc_flag = getCCFlag (); >> + * if((cc_flag == true)) >> + * { >> + * if(((@src2 != 0) && ((@src1 != 2147483648) || (@src2 != >> 4294967295 >> + * { >> + * @dest = divSigned (@src1, @src2); >> + * if((getFFlag () == true)) >> + * { >> + * setZFlag (@dest); >> + * setNFlag (@dest); >> + * setVFlag (0); >> + * }; >> + * } >> + * else >> + * { >> + * }; >> + * }; >> + * } >> + */ >> + >> +int >> +arc_gen_DIV(DisasCtxt *ctx, TCGv src2, TCGv src1, TCGv dest) >> +{ >