@@ -865,3 +865,57 @@ define <vscale x 8 x i32> @vadd_vv_mask_negative1_nxv8i32(<vscale x 8 x i32> %va
865865 %vd = add <vscale x 8 x i32 > %vc , %vs
866866 ret <vscale x 8 x i32 > %vd
867867}
868+
869+ define <vscale x 1 x i64 > @vadd_vx_imm64_to_sub (<vscale x 1 x i64 > %va ) nounwind {
870+ ; RV32-LABEL: vadd_vx_imm64_to_sub:
871+ ; RV32: # %bb.0:
872+ ; RV32-NEXT: addi sp, sp, -16
873+ ; RV32-NEXT: li a0, -256
874+ ; RV32-NEXT: li a1, 1
875+ ; RV32-NEXT: sw a1, 8(sp)
876+ ; RV32-NEXT: sw a0, 12(sp)
877+ ; RV32-NEXT: addi a0, sp, 8
878+ ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
879+ ; RV32-NEXT: vlse64.v v9, (a0), zero
880+ ; RV32-NEXT: vadd.vv v8, v8, v9
881+ ; RV32-NEXT: addi sp, sp, 16
882+ ; RV32-NEXT: ret
883+ ;
884+ ; RV64-LABEL: vadd_vx_imm64_to_sub:
885+ ; RV64: # %bb.0:
886+ ; RV64-NEXT: li a0, -1
887+ ; RV64-NEXT: slli a0, a0, 40
888+ ; RV64-NEXT: addi a0, a0, 1
889+ ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
890+ ; RV64-NEXT: vadd.vx v8, v8, a0
891+ ; RV64-NEXT: ret
892+ %vc = add <vscale x 1 x i64 > splat (i64 -1099511627775 ), %va
893+ ret <vscale x 1 x i64 > %vc
894+ }
895+
896+ define <vscale x 1 x i64 > @vadd_vx_imm64_to_sub_swapped (<vscale x 1 x i64 > %va ) nounwind {
897+ ; RV32-LABEL: vadd_vx_imm64_to_sub_swapped:
898+ ; RV32: # %bb.0:
899+ ; RV32-NEXT: addi sp, sp, -16
900+ ; RV32-NEXT: li a0, -256
901+ ; RV32-NEXT: li a1, 1
902+ ; RV32-NEXT: sw a1, 8(sp)
903+ ; RV32-NEXT: sw a0, 12(sp)
904+ ; RV32-NEXT: addi a0, sp, 8
905+ ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
906+ ; RV32-NEXT: vlse64.v v9, (a0), zero
907+ ; RV32-NEXT: vadd.vv v8, v8, v9
908+ ; RV32-NEXT: addi sp, sp, 16
909+ ; RV32-NEXT: ret
910+ ;
911+ ; RV64-LABEL: vadd_vx_imm64_to_sub_swapped:
912+ ; RV64: # %bb.0:
913+ ; RV64-NEXT: li a0, -1
914+ ; RV64-NEXT: slli a0, a0, 40
915+ ; RV64-NEXT: addi a0, a0, 1
916+ ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
917+ ; RV64-NEXT: vadd.vx v8, v8, a0
918+ ; RV64-NEXT: ret
919+ %vc = add <vscale x 1 x i64 > %va , splat (i64 -1099511627775 )
920+ ret <vscale x 1 x i64 > %vc
921+ }
0 commit comments