Skip to content

Commit cf6016c

Browse files
authored
Merge pull request #160 from sx-aurora-dev/merge/mor-mand-mxor
Merge/mor mand mxor
2 parents 2ec3a32 + 783f7fe commit cf6016c

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

llvm/lib/Target/VE/VEInstrPatternsVec.td

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ def : Pat<(store v512i1:$vx, ADDRrii:$addr),
7676

7777
///// Mask Arithmetic /////
7878

79-
// Mask arithmetic
80-
multiclass MaskArith<ValueType MaskVT, string MaskTag="mmm"> {
81-
def : Pat<(MaskVT (and MaskVT:$ma, MaskVT:$mb)), (!cast<Instruction>("ANDM"#MaskTag#MaskTag) $ma, $mb)>;
82-
def : Pat<(MaskVT (or MaskVT:$ma, MaskVT:$mb)), (!cast<Instruction>("ORM"#MaskTag#MaskTag) $ma, $mb)>;
83-
def : Pat<(MaskVT (xor MaskVT:$ma, MaskVT:$mb)), (!cast<Instruction>("XORM"#MaskTag#MaskTag) $ma, $mb)>;
84-
}
79+
class Mask_Binary<ValueType MaskVT, SDPatternOperator MaskOp, string InstName> :
80+
Pat<(MaskVT (MaskOp MaskVT:$ma, MaskVT:$mb)), (!cast<Instruction>(InstName#"mm") $ma, $mb)>;
8581

86-
defm: MaskArith<v256i1,"m">;
82+
def: Mask_Binary<v256i1, and, "ANDM">;
83+
def: Mask_Binary<v256i1, or, "ORM">;
84+
def: Mask_Binary<v256i1, xor, "XORM">;
8785

8886
// FIXME: Valid but very inefficient (incurs repetitive unpacking and packing).
8987
// split pattern (unpack splice, pack)
@@ -242,7 +240,6 @@ defm : vbrd_elem64<v512f32, i64, simm7, LO7>;
242240
defm : vbrd_elem64<v512i32, f64, simm7fp, LO7FP>;
243241
defm : vbrd_elem64<v512f32, f64, simm7fp, LO7FP>;
244242

245-
246243
///// vec_seq /////
247244

248245
def: Pat<(v512i32 (vec_seq i32:$vl)),
@@ -440,3 +437,4 @@ def : Pat<(v512i1 (vec_broadcast (i32 0), (i32 512))),
440437
// def : Pat<(store v256f64:$vx, I64:$addr),
441438
// (VSTirvl 8, $addr, v256f64:$vx, (VLEN 256))>;
442439
// }
440+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s -mtriple=ve -mattr=+vpu | FileCheck %s
3+
4+
; Function Attrs: nounwind
5+
define fastcc <256 x i1> @and_mm_v256i1(<256 x i1> %x, <256 x i1> %y) {
6+
; CHECK-LABEL: and_mm_v256i1:
7+
; CHECK: # %bb.0:
8+
; CHECK-NEXT: andm %vm1, %vm1, %vm2
9+
; CHECK-NEXT: b.l.t (, %s10)
10+
%z = and <256 x i1> %x, %y
11+
ret <256 x i1> %z
12+
}
13+
14+
; Function Attrs: nounwind
15+
define fastcc <256 x i1> @or_mm_v256i1(<256 x i1> %x, <256 x i1> %y) {
16+
; CHECK-LABEL: or_mm_v256i1:
17+
; CHECK: # %bb.0:
18+
; CHECK-NEXT: orm %vm1, %vm1, %vm2
19+
; CHECK-NEXT: b.l.t (, %s10)
20+
%z = or <256 x i1> %x, %y
21+
ret <256 x i1> %z
22+
}
23+
24+
; Function Attrs: nounwind
25+
define fastcc <256 x i1> @xor_mm_v256i1(<256 x i1> %x, <256 x i1> %y) {
26+
; CHECK-LABEL: xor_mm_v256i1:
27+
; CHECK: # %bb.0:
28+
; CHECK-NEXT: xorm %vm1, %vm1, %vm2
29+
; CHECK-NEXT: b.l.t (, %s10)
30+
%z = xor <256 x i1> %x, %y
31+
ret <256 x i1> %z
32+
}
33+

0 commit comments

Comments
 (0)