[llvm] [WIP][DAG] Add legalization handling for AVGCEIL/AVGFLOOR nodes (PR #92096)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue May 21 02:30:41 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
----------------
RKSimon wrote:
Yes, it should return -1:
```
avgfloors(lhs, rhs) -> add(and(lhs,rhs),ashr(xor(lhs,rhs),1))
avgfloors(lhs, rhs) -> trunc(ashr(add(sext(lhs),sext(rhs)),1))
avgfloors(lhs, rhs) -> trunc(lshr(add(sext(lhs),sext(rhs)),1))
```
https://github.com/llvm/llvm-project/pull/92096
More information about the llvm-commits
mailing list