1 ; This test makes sure that mul instructions are properly eliminated.
4 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul
14 %B = mul int %A, 2 ; Should convert to an add instruction
19 %B = mul int %A, 0 ; This should disappear entirely
23 double %test4(double %A) {
24 %B = mul double 1.0, %A ; This is safe for FP
33 ubyte %test6(ubyte %A) {
40 %tmp = mul int %i, -1 ; %tmp = sub 0, %i
44 ulong %test8(ulong %i) {
45 %j = mul ulong %i, 18446744073709551615 ; tmp = sub 0, %i
49 uint %test9(uint %i) {
50 %j = mul uint %i, 4294967295 ; %j = sub 0, %i
54 uint %test10(int %a, uint %b) {
56 %d = cast bool %c to uint
57 %e = mul uint %d, %b ; e = b & (a >> 31)
61 uint %test11(int %a, uint %b) {
63 %d = cast bool %c to uint
64 %e = mul uint %d, %b ; e = b & (a >> 31)
68 uint %test11(ubyte %a, uint %b) {
69 %c = setgt ubyte %a, 127
70 %d = cast bool %c to uint
71 %e = mul uint %d, %b ; e = b & (a >> 31)