muldi3, divdi3 and remdi3 patterns
Mark Klein
mklein@dis.com
Sat Aug 7 13:56:00 GMT 1999
I've got a puzzle that I've been poking at off and on for the past
number of weeks, and I guess it's time to ask for help.
In adding muldi3, divdi3 and remdi3 instruction patterns, I find
that the compiler is choosing to do remsi3 as a widened X-Y*(X/Y)
instead of simply using the remsi3 pattern. It starts down this
path in expand_divmod when expand_mult_highpart recognizes it can
use the muldi3 pattern.
Any ideas?
TIA,
M.
--- snip ---
My source:
#define HASH_TABLE_SIZE 31
extern int string_hash_fun(void);
int
internString()
{
return (string_hash_fun() % HASH_TABLE_SIZE);
}
--- the rtl ---
;; Function internString
(note 2 0 3 "" NOTE_INSN_DELETED)
(note 3 2 4 "" NOTE_INSN_FUNCTION_BEG)
(note 4 3 6 "" NOTE_INSN_DELETED)
(note 6 4 8 "" NOTE_INSN_DELETED)
(call_insn 8 6 10 (parallel[
(set (reg:SI 28 %r28)
(call (mem:SI (symbol_ref/v:SI ("@string_hash_fun")) 0)
(const_int 16 [0x10])))
(clobber (reg:SI 2 %r2))
(use (const_int 0 [0x0]))
] ) -1 (nil)
(nil)
(nil))
(insn 10 8 14 (set (reg:SI 95)
(reg:SI 28 %r28)) -1 (nil)
(nil))
(insn 14 10 17 (set (reg:SI 99)
(ashiftrt:SI (reg:SI 95)
(const_int 31 [0x1f]))) -1 (nil)
(nil))
(insn 17 14 12 (clobber (reg:DI 98)) -1 (nil)
(insn_list:REG_LIBCALL 19 (nil)))
(insn 12 17 16 (set (subreg:SI (reg:DI 98) 1)
(reg:SI 95)) -1 (nil)
(expr_list:REG_NO_CONFLICT (reg:SI 95)
(nil)))
(insn 16 12 19 (set (subreg:SI (reg:DI 98) 0)
(reg:SI 99)) -1 (nil)
(expr_list:REG_NO_CONFLICT (reg:SI 95)
(nil)))
(insn 19 16 20 (set (reg:DI 98)
(reg:DI 98)) -1 (nil)
(insn_list:REG_RETVAL 17 (expr_list:REG_EQUAL (sign_extend:DI (reg:SI 95))
(nil))))
(insn 20 19 21 (set (reg:DI 101)
(high:DI (const_int -2078209981 [0x84210843]))) -1 (nil)
(nil))
(insn 21 20 22 (set (reg:DI 100)
(lo_sum:DI (reg:DI 101)
(const_int -2078209981 [0x84210843]))) -1 (nil)
(nil))
(insn 22 21 23 (set (reg:DI 25 %r25)
(reg:DI 98)) -1 (nil)
(nil))
(insn 23 22 24 (set (reg:DI 23 %r23)
(reg:DI 100)) -1 (nil)
(nil))
(insn 24 23 25 (parallel[
(set (reg:DI 28 %r28)
(mult:DI (reg:DI 25 %r25)
(reg:DI 23 %r23)))
(clobber (reg:SI 102))
(clobber (reg:DI 25 %r25))
(clobber (reg:DI 23 %r23))
(clobber (reg:SI 31 %r31))
] ) -1 (nil)
(nil))
(insn 25 24 26 (set (reg:DI 97)
(reg:DI 28 %r28)) -1 (nil)
(expr_list:REG_EQUAL (mult:DI (reg:DI 98)
(reg:DI 100))
(nil)))
(insn 26 25 28 (set (reg:SI 103)
(plus:SI (reg:SI 95)
(subreg:SI (reg:DI 97) 0))) -1 (nil)
(nil))
(insn 28 26 30 (set (reg:SI 104)
(ashiftrt:SI (reg:SI 103)
(const_int 4 [0x4]))) -1 (nil)
(nil))
(insn 30 28 31 (set (reg:SI 105)
(ashiftrt:SI (reg:SI 95)
(const_int 31 [0x1f]))) -1 (nil)
(nil))
(insn 31 30 33 (set (reg:SI 94)
(minus:SI (reg:SI 104)
(reg:SI 105))) -1 (nil)
(expr_list:REG_EQUAL (div:SI (reg:SI 95)
(const_int 31 [0x1f]))
(nil)))
(insn 33 31 35 (set (reg:SI 106)
(reg:SI 94)) -1 (nil)
(nil))
(insn 35 33 36 (set (reg:SI 107)
(ashift:SI (reg:SI 106)
(const_int 5 [0x5]))) -1 (nil)
(expr_list:REG_EQUAL (mult:SI (reg:SI 94)
(const_int 32 [0x20]))
(nil)))
(insn 36 35 37 (set (reg:SI 107)
(minus:SI (reg:SI 107)
(reg:SI 94))) -1 (nil)
(expr_list:REG_EQUAL (mult:SI (reg:SI 94)
(const_int 31 [0x1f]))
(nil)))
(insn 37 36 39 (set (reg:SI 94)
(minus:SI (reg:SI 95)
(reg:SI 107))) -1 (nil)
(nil))
(insn 39 37 40 (set (reg/i:SI 28 %r28)
(reg:SI 94)) -1 (nil)
(nil))
(insn 40 39 41 (use (reg/i:SI 28 %r28)) -1 (nil)
(nil))
(jump_insn 41 40 42 (set (pc)
(label_ref 46)) -1 (nil)
(nil))
(barrier 42 41 44)
(note 44 42 46 "" NOTE_INSN_FUNCTION_END)
(code_label 46 44 0 2 "" [num uses: 0])
--- snip ---
--
Mark Klein DIS International, Ltd.
http://www.dis.com 415-892-8400
PGP Public Key Available
More information about the Gcc
mailing list