%r = and i8 %a, 15
ret i8 %r
}
+
+define i8 @muladd_demand_2(i8 %x, i8 %y) nounwind {
+; RV32I-LABEL: muladd_demand_2:
+; RV32I: # %bb.0:
+; RV32I-NEXT: slli a0, a0, 1
+; RV32I-NEXT: sub a0, a1, a0
+; RV32I-NEXT: ori a0, a0, -16
+; RV32I-NEXT: ret
+;
+; RV32IM-LABEL: muladd_demand_2:
+; RV32IM: # %bb.0:
+; RV32IM-NEXT: slli a0, a0, 1
+; RV32IM-NEXT: sub a0, a1, a0
+; RV32IM-NEXT: ori a0, a0, -16
+; RV32IM-NEXT: ret
+;
+; RV64I-LABEL: muladd_demand_2:
+; RV64I: # %bb.0:
+; RV64I-NEXT: slliw a0, a0, 1
+; RV64I-NEXT: subw a0, a1, a0
+; RV64I-NEXT: ori a0, a0, -16
+; RV64I-NEXT: ret
+;
+; RV64IM-LABEL: muladd_demand_2:
+; RV64IM: # %bb.0:
+; RV64IM-NEXT: slliw a0, a0, 1
+; RV64IM-NEXT: subw a0, a1, a0
+; RV64IM-NEXT: ori a0, a0, -16
+; RV64IM-NEXT: ret
+ %m = mul i8 %x, 14
+ %a = add i8 %y, %m
+ %r = or i8 %a, 240
+ ret i8 %r
+}
+
+define i8 @mulsub_demand_2(i8 %x, i8 %y) nounwind {
+; RV32I-LABEL: mulsub_demand_2:
+; RV32I: # %bb.0:
+; RV32I-NEXT: slli a0, a0, 1
+; RV32I-NEXT: add a0, a1, a0
+; RV32I-NEXT: ori a0, a0, -16
+; RV32I-NEXT: ret
+;
+; RV32IM-LABEL: mulsub_demand_2:
+; RV32IM: # %bb.0:
+; RV32IM-NEXT: slli a0, a0, 1
+; RV32IM-NEXT: add a0, a1, a0
+; RV32IM-NEXT: ori a0, a0, -16
+; RV32IM-NEXT: ret
+;
+; RV64I-LABEL: mulsub_demand_2:
+; RV64I: # %bb.0:
+; RV64I-NEXT: slliw a0, a0, 1
+; RV64I-NEXT: addw a0, a1, a0
+; RV64I-NEXT: ori a0, a0, -16
+; RV64I-NEXT: ret
+;
+; RV64IM-LABEL: mulsub_demand_2:
+; RV64IM: # %bb.0:
+; RV64IM-NEXT: slliw a0, a0, 1
+; RV64IM-NEXT: addw a0, a1, a0
+; RV64IM-NEXT: ori a0, a0, -16
+; RV64IM-NEXT: ret
+ %m = mul i8 %x, 14
+ %a = sub i8 %y, %m
+ %r = or i8 %a, 240
+ ret i8 %r
+}