@@ -892,6 +892,11 @@ def ROTW : RRR_Inst<0x00, 0x00, 0x04, (outs), (ins imm8n_7:$imm),
892
892
//===----------------------------------------------------------------------===//
893
893
// Boolean Instructions
894
894
//===----------------------------------------------------------------------===//
895
+ class BIN_PAT<SDPatternOperator node, Instruction inst,
896
+ ValueType src_vt, ValueType dst_vt = src_vt>
897
+ : Pat<(dst_vt (node src_vt:$f1, src_vt:$f2)),
898
+ (inst src_vt:$f1, src_vt:$f2)>;
899
+
895
900
896
901
def ALL4 : RRR_Inst<0x00, 0x00, 0x00, (outs BR:$t), (ins BR:$s),
897
902
"all4\t$t, $s", []>, Requires<[HasBoolean]> {
@@ -907,6 +912,12 @@ def ANDB : RRR_Inst<0x00, 0x02, 0x00, (outs BR:$r), (ins BR:$s, BR:$t),
907
912
"andb\t$r, $s, $t", []>, Requires<[HasBoolean]>;
908
913
def ANDBC : RRR_Inst<0x00, 0x02, 0x01, (outs BR:$r), (ins BR:$s, BR:$t),
909
914
"andbc\t$r, $s, $t", []>, Requires<[HasBoolean]>;
915
+ def ORB : RRR_Inst<0x00, 0x02, 0x02, (outs BR:$r), (ins BR:$s, BR:$t),
916
+ "orb\t$r, $s, $t", []>, Requires<[HasBoolean]>;
917
+ def ORBC : RRR_Inst<0x00, 0x02, 0x03, (outs BR:$r), (ins BR:$s, BR:$t),
918
+ "orbc\t$r, $s, $t", []>, Requires<[HasBoolean]>;
919
+ def XORB : RRR_Inst<0x00, 0x02, 0x04, (outs BR:$r), (ins BR:$s, BR:$t),
920
+ "xorb\t$r, $s, $t", []>, Requires<[HasBoolean]>;
910
921
911
922
def ANY4 : RRR_Inst<0x00, 0x00, 0x00, (outs BR:$t), (ins BR:$s),
912
923
"any4\t$t, $s", []>, Requires<[HasBoolean]> {
@@ -942,21 +953,67 @@ let isBranch = 1, isTerminator = 1, Predicates = [HasBoolean] in {
942
953
}
943
954
}
944
955
945
- def MOVF : RRR_Inst<0x00, 0x03, 0x0C, (outs AR:$r), (ins AR:$s, BR:$t),
956
+ let Constraints = "$dr = $r,@earlyclobber $dr" in {
957
+ def MOVF : RRR_Inst<0x00, 0x03, 0x0C, (outs AR:$dr), (ins AR:$r, AR:$s, BR:$t),
946
958
"movf\t$r, $s, $t", []>, Requires<[HasBoolean]>;
947
- def MOVT : RRR_Inst<0x00, 0x03, 0x0D, (outs AR:$r), (ins AR:$s, BR:$t),
948
- "movt\t$r, $s, $t", []>, Requires<[HasBoolean]>;
949
959
950
- def ORB : RRR_Inst<0x00, 0x02, 0x02, (outs BR:$r), (ins BR:$s, BR:$t),
951
- "orb\t$r, $s, $t", []>, Requires<[HasBoolean]>;
952
- def ORBC : RRR_Inst<0x00, 0x02, 0x03, (outs BR:$r), (ins BR:$s, BR:$t),
953
- "orbc\t$r, $s, $t", []>, Requires<[HasBoolean]>;
954
- def XORB : RRR_Inst<0x00, 0x02, 0x04, (outs BR:$r), (ins BR:$s, BR:$t),
955
- "xorb\t$r, $s, $t", []>, Requires<[HasBoolean]>;
960
+ def MOVT : RRR_Inst<0x00, 0x03, 0x0D, (outs AR:$dr), (ins AR:$r, AR:$s, BR:$t),
961
+ "movt\t$r, $s, $t", []>, Requires<[HasBoolean]>;
962
+ }
956
963
957
964
def : Pat<(Xtensa_br_t BR:$b, bb:$target), (BT BR:$b, bb:$target)>;
958
965
def : Pat<(Xtensa_br_f BR:$b, bb:$target), (BF BR:$b, bb:$target)>;
959
966
967
+ let Predicates = [HasBoolean] in {
968
+
969
+ def OR_BR_PAT: BIN_PAT<or,ORB,v1i1>;
970
+ def XOR_BR_PAT: BIN_PAT<xor,XORB,v1i1>;
971
+ def AND_BR_PAT: BIN_PAT<and,ANDB,v1i1>;
972
+
973
+ // vselect C T F = C * T + ~C * F
974
+ def : Pat<(v1i1 (vselect v1i1:$c, v1i1:$t, v1i1:$f)),
975
+ (ORB (ANDB $t, $f), (ANDBC $f, $c))>;
976
+
977
+
978
+ def MOVBA_P2: Pseudo<(outs BR:$r, AR:$x, AR:$y), (ins AR:$s),
979
+ "!movba $r, $x, $y, $s", []> {
980
+ let Defs = [BREG];
981
+ }
982
+
983
+ def MOVBA_P: Pseudo<(outs BR:$r), (ins AR:$s),
984
+ "!movba $r, $s", []> {
985
+ let usesCustomInserter = 1;
986
+ let Defs = [BREG];
987
+ //let Uses = [BREG];
988
+ }
989
+
990
+ def EXTUI_BR_P: Pseudo<(outs AR:$r), (ins AR:$s, BR:$b),
991
+ "!extui_br $r, $s, $b", []>;
992
+ def SLLI_BR_P: Pseudo<(outs AR:$r), (ins AR:$s, BR:$b),
993
+ "!slli_br $r, $s, $b", []>;
994
+
995
+ def : Pat<(v1i1 (build_vector AR:$a)), (MOVBA_P AR:$a)>;
996
+
997
+ def : Pat<(i32 (vector_extract (v1i1 BR:$b), (i32 0))),
998
+ (EXTUI_BR_P (RSR BREG), BR:$b)>;
999
+
1000
+ def : Pat<(v1i1 (load addr_ish1:$addr)), (MOVBA_P (L8UI mem8:$addr))>;
1001
+
1002
+ def : Pat<(store BR:$b, addr_ish1:$addr), (S8I (EXTUI_BR_P (RSR BREG), BR:$b), mem32:$addr)>;
1003
+
1004
+ def SPILL_BOOL: Pseudo<(outs), (ins BR:$b, mem8:$mem),
1005
+ "!spill_bool $b, $mem",[]> {
1006
+ let mayStore = 1;
1007
+ }
1008
+
1009
+ def RESTORE_BOOL: Pseudo<(outs BR:$out), (ins mem8:$mem),
1010
+ "!restore_bool $out, $mem",[]> {
1011
+ let mayLoad = 1;
1012
+ let Defs = [BREG];
1013
+ }
1014
+ }
1015
+
1016
+
960
1017
//===----------------------------------------------------------------------===//
961
1018
// Floating-Point Instructions
962
1019
//===----------------------------------------------------------------------===//
0 commit comments