@@ -886,6 +886,64 @@ define i32 @caller_small_scalar_ret() nounwind {
886
886
ret i32 %3
887
887
}
888
888
889
+ ; Check return of >2x xlen scalars
890
+
891
+ define i128 @callee_large_scalar_ret () nounwind {
892
+ ; RV32I-LABEL: name: callee_large_scalar_ret
893
+ ; RV32I: bb.1 (%ir-block.0):
894
+ ; RV32I-NEXT: [[C:%[0-9]+]]:_(s128) = G_CONSTANT i128 1234567898765432123456789
895
+ ; RV32I-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0
896
+ ; RV32I-NEXT: G_STORE [[C]](s128), [[FRAME_INDEX]](p0) :: (store (s128) into %stack.0, align 8)
897
+ ; RV32I-NEXT: $x10 = COPY [[FRAME_INDEX]](p0)
898
+ ; RV32I-NEXT: PseudoRET implicit $x10
899
+ ret i128 1234567898765432123456789
900
+ }
901
+
902
+ define i32 @caller_large_scalar_ret () nounwind {
903
+ ; ILP32-LABEL: name: caller_large_scalar_ret
904
+ ; ILP32: bb.1 (%ir-block.0):
905
+ ; ILP32-NEXT: [[C:%[0-9]+]]:_(s128) = G_CONSTANT i128 9876543212345678987654321
906
+ ; ILP32-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
907
+ ; ILP32-NEXT: PseudoCALL target-flags(riscv-call) @callee_large_scalar_ret, csr_ilp32_lp64, implicit-def $x1, implicit-def $x10
908
+ ; ILP32-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
909
+ ; ILP32-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
910
+ ; ILP32-NEXT: [[LOAD:%[0-9]+]]:_(s128) = G_LOAD [[COPY]](p0) :: (load (s128), align 8)
911
+ ; ILP32-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[C]](s128), [[LOAD]]
912
+ ; ILP32-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP]](s1)
913
+ ; ILP32-NEXT: $x10 = COPY [[ZEXT]](s32)
914
+ ; ILP32-NEXT: PseudoRET implicit $x10
915
+ ;
916
+ ; ILP32F-LABEL: name: caller_large_scalar_ret
917
+ ; ILP32F: bb.1 (%ir-block.0):
918
+ ; ILP32F-NEXT: [[C:%[0-9]+]]:_(s128) = G_CONSTANT i128 9876543212345678987654321
919
+ ; ILP32F-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
920
+ ; ILP32F-NEXT: PseudoCALL target-flags(riscv-call) @callee_large_scalar_ret, csr_ilp32f_lp64f, implicit-def $x1, implicit-def $x10
921
+ ; ILP32F-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
922
+ ; ILP32F-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
923
+ ; ILP32F-NEXT: [[LOAD:%[0-9]+]]:_(s128) = G_LOAD [[COPY]](p0) :: (load (s128), align 8)
924
+ ; ILP32F-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[C]](s128), [[LOAD]]
925
+ ; ILP32F-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP]](s1)
926
+ ; ILP32F-NEXT: $x10 = COPY [[ZEXT]](s32)
927
+ ; ILP32F-NEXT: PseudoRET implicit $x10
928
+ ;
929
+ ; ILP32D-LABEL: name: caller_large_scalar_ret
930
+ ; ILP32D: bb.1 (%ir-block.0):
931
+ ; ILP32D-NEXT: [[C:%[0-9]+]]:_(s128) = G_CONSTANT i128 9876543212345678987654321
932
+ ; ILP32D-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
933
+ ; ILP32D-NEXT: PseudoCALL target-flags(riscv-call) @callee_large_scalar_ret, csr_ilp32d_lp64d, implicit-def $x1, implicit-def $x10
934
+ ; ILP32D-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
935
+ ; ILP32D-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
936
+ ; ILP32D-NEXT: [[LOAD:%[0-9]+]]:_(s128) = G_LOAD [[COPY]](p0) :: (load (s128), align 8)
937
+ ; ILP32D-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[C]](s128), [[LOAD]]
938
+ ; ILP32D-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP]](s1)
939
+ ; ILP32D-NEXT: $x10 = COPY [[ZEXT]](s32)
940
+ ; ILP32D-NEXT: PseudoRET implicit $x10
941
+ %1 = call i128 @callee_large_scalar_ret ()
942
+ %2 = icmp eq i128 9876543212345678987654321 , %1
943
+ %3 = zext i1 %2 to i32
944
+ ret i32 %3
945
+ }
946
+
889
947
; Check return of 2x xlen structs
890
948
891
949
%struct.small = type { i32 , ptr }
0 commit comments