in function cryptcompress_truncate() from reiserfs4 patch compiler uses __cmpdi2 for old_size vs new_size (64 bit) comparision: result = (old_size < new_size ? cryptcompress_append_hole(inode, new_size) : prune_cryptcompress(inode, new_size, update_sd, aidx)); in another case for simple foo() method gcc inlines __cmpdi2 equivalent: int foo(long long x, long long y) { return (x < y); } foo: cmpw 7,5,3 li 0,0 bgt- 7,.L3 cmplw 6,6,4 beq- 7,.L6 .L2: mr 3,0 blr .L6: ble- 6,.L2 .L3: li 0,1 mr 3,0 blr what decides which variant is chosen? is it possible to force inlining? # gcc-4.0.0+pr20973+pr21173
Created attachment 8745 [details] testcase
Created attachment 8746 [details] asm dump
Confirmed, reduced testcase: int g(long long a, long long b) { a -= b; return !a; } You were looking at the wrong function as we inline a function into cryptcompress_truncate which causes this. One issue is when we go and expand (a - b) == 0, we expand it to cmpdi for some reason instead of inlining cmpdi.
__cmdi2 isn't used with -O0 but it is with -O1.
i386 synthesizes a DImode compare for 32-bit mode in target-dependent code. PowerPC probably needs to do the same.
Subject: Bug 21237 CVSROOT: /cvs/gcc Module name: gcc Changes by: dje@gcc.gnu.org 2005-05-09 14:45:59 Modified files: gcc : ChangeLog Log message: PR middle-end/21237 * dojump.c (do_jump, MINUS_EXPR): Build NE_EXPR and fall through to NE_EXPR case. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8673&r2=2.8674
Subject: Bug 21237 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: dje@gcc.gnu.org 2005-05-14 00:46:01 Modified files: gcc : ChangeLog dojump.c Log message: PR middle-end/21237 * dojump.c (do_jump, MINUS_EXPR): Build NE_EXPR and fall through to NE_EXPR case. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.244&r2=2.7592.2.245 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dojump.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.37&r2=1.37.8.1
backported patch