[llvm] [WIP][DAG] Add legalization handling for AVGCEIL/AVGFLOOR nodes (PR #92096)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 16:06:44 PDT 2024


================
@@ -39,8 +39,10 @@ define <8 x i8> @vaaddu_vv_v8i8_floor_sexti16(<8 x i8> %x, <8 x i8> %y) {
 ; CHECK-LABEL: vaaddu_vv_v8i8_floor_sexti16:
 ; CHECK:       # %bb.0:
 ; CHECK-NEXT:    vsetivli zero, 8, e8, mf2, ta, ma
-; CHECK-NEXT:    vwadd.vv v10, v8, v9
-; CHECK-NEXT:    vnsrl.wi v8, v10, 1
+; CHECK-NEXT:    vand.vv v10, v8, v9
+; CHECK-NEXT:    vxor.vv v8, v8, v9
+; CHECK-NEXT:    vsra.vi v8, v8, 1
+; CHECK-NEXT:    vadd.vv v8, v10, v8
----------------
topperc wrote:

Does AVGFLOORS of -1 and 0 return -1? I think that's what stopped this from getting implemented before. There was maybe confusion around the meaning of "average". https://github.com/riscv/riscv-v-spec/issues/935

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


More information about the llvm-commits mailing list