[llvm] [SDAG] Use shifts if ISD::MUL is illegal when lowering ISD::CTPOP (PR #86505)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 13:48:10 PDT 2024


================
@@ -285,9 +285,12 @@ define i32 @test_ctpop_i32(i32 %a) nounwind {
 ; LA64-NEXT:    lu12i.w $a1, 61680
 ; LA64-NEXT:    ori $a1, $a1, 3855
 ; LA64-NEXT:    and $a0, $a0, $a1
-; LA64-NEXT:    lu12i.w $a1, 4112
-; LA64-NEXT:    ori $a1, $a1, 257
-; LA64-NEXT:    mul.d $a0, $a0, $a1
+; LA64-NEXT:    slli.d $a1, $a0, 8
----------------
efriedma-quic wrote:

You're querying whether i32 mul is legal, and it isn't... because i32 isn't legal.  You need to query whether i64 mul is legal.  (I think there's a method somewhere to get the promoted type corresponding to a type; don't remember the name off the top of my head.)

https://github.com/llvm/llvm-project/pull/86505


More information about the llvm-commits mailing list