OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2912 | 2912 |
2913 TEST(vswp) { | 2913 TEST(vswp) { |
2914 if (!CpuFeatures::IsSupported(NEON)) return; | 2914 if (!CpuFeatures::IsSupported(NEON)) return; |
2915 | 2915 |
2916 CcTest::InitializeVM(); | 2916 CcTest::InitializeVM(); |
2917 Isolate* isolate = CcTest::i_isolate(); | 2917 Isolate* isolate = CcTest::i_isolate(); |
2918 HandleScope scope(isolate); | 2918 HandleScope scope(isolate); |
2919 Assembler assm(isolate, NULL, 0); | 2919 Assembler assm(isolate, NULL, 0); |
2920 | 2920 |
2921 typedef struct { | 2921 typedef struct { |
2922 double result0; | 2922 uint64_t result0; |
2923 double result1; | 2923 uint64_t result1; |
2924 double result2; | 2924 uint64_t result2; |
2925 double result3; | 2925 uint64_t result3; |
2926 double result4; | 2926 uint64_t result4; |
2927 double result5; | 2927 uint64_t result5; |
2928 double result6; | 2928 uint64_t result6; |
2929 double result7; | 2929 uint64_t result7; |
2930 } T; | 2930 } T; |
2931 T t; | 2931 T t; |
2932 | 2932 |
2933 __ vmov(d0, 1.0); | 2933 __ stm(db_w, sp, r4.bit() | r5.bit() | r6.bit() | r7.bit() | lr.bit()); |
2934 __ vmov(d1, -1.0); | 2934 |
2935 uint64_t one = bit_cast<uint64_t>(1.0); | |
2936 __ mov(r5, Operand(one >> 32)); | |
2937 __ mov(r4, Operand(one & 0xffffffff)); | |
2938 uint64_t minus_one = bit_cast<uint64_t>(-1.0); | |
2939 __ mov(r7, Operand(minus_one >> 32)); | |
2940 __ mov(r6, Operand(minus_one & 0xffffffff)); | |
2941 | |
2942 __ vmov(d0, r4, r5); // d0 = 1.0 | |
2943 __ vmov(d1, r6, r7); // d1 = -1.0 | |
2935 __ vswp(d0, d1); | 2944 __ vswp(d0, d1); |
2936 __ vstr(d0, r0, offsetof(T, result0)); | 2945 __ vstr(d0, r0, offsetof(T, result0)); |
2937 __ vstr(d1, r0, offsetof(T, result1)); | 2946 __ vstr(d1, r0, offsetof(T, result1)); |
2938 | 2947 |
2939 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 2948 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
2940 __ vmov(d30, 1.0); | 2949 __ vmov(d30, r4, r5); // d30 = 1.0 |
2941 __ vmov(d31, -1.0); | 2950 __ vmov(d31, r6, r7); // d31 = -1.0 |
2942 __ vswp(d30, d31); | 2951 __ vswp(d30, d31); |
2943 __ vstr(d30, r0, offsetof(T, result2)); | 2952 __ vstr(d30, r0, offsetof(T, result2)); |
2944 __ vstr(d31, r0, offsetof(T, result3)); | 2953 __ vstr(d31, r0, offsetof(T, result3)); |
2945 } | 2954 } |
2946 | 2955 |
2947 // q-register swap. | 2956 // q-register swap. |
2948 __ vmov(d8, 1.0); | 2957 __ vmov(d8, r4, r5); |
2949 __ vmov(d9, 2.0); | 2958 __ vmov(d9, r4, r5); // q4 = [1.0, 1.0] |
2950 __ vmov(d10, 3.0); | 2959 __ vmov(d10, r6, r7); |
2951 __ vmov(d11, 4.0); | 2960 __ vmov(d11, r6, r7); // q5 = [-1.0, -1.0] |
2952 __ vswp(q4, q5); | 2961 __ vswp(q4, q5); |
2953 __ vstr(d8, r0, offsetof(T, result4)); | 2962 __ vstr(d8, r0, offsetof(T, result4)); |
2954 __ vstr(d9, r0, offsetof(T, result5)); | 2963 __ vstr(d9, r0, offsetof(T, result5)); |
2955 __ vstr(d10, r0, offsetof(T, result6)); | 2964 __ vstr(d10, r0, offsetof(T, result6)); |
2956 __ vstr(d11, r0, offsetof(T, result7)); | 2965 __ vstr(d11, r0, offsetof(T, result7)); |
2957 | 2966 |
2967 __ ldm(ia_w, sp, r4.bit() | r5.bit() | r6.bit() | r7.bit() | pc.bit()); | |
2958 __ bx(lr); | 2968 __ bx(lr); |
2959 | 2969 |
2960 CodeDesc desc; | 2970 CodeDesc desc; |
2961 assm.GetCode(&desc); | 2971 assm.GetCode(&desc); |
2962 Handle<Code> code = isolate->factory()->NewCode( | 2972 Handle<Code> code = isolate->factory()->NewCode( |
2963 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 2973 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
2964 #ifdef DEBUG | 2974 #ifdef DEBUG |
2965 OFStream os(stdout); | 2975 OFStream os(stdout); |
2966 code->Print(os); | 2976 code->Print(os); |
2967 #endif | 2977 #endif |
2968 F3 f = FUNCTION_CAST<F3>(code->entry()); | 2978 F3 f = FUNCTION_CAST<F3>(code->entry()); |
2969 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); | 2979 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); |
2970 USE(dummy); | 2980 USE(dummy); |
2971 CHECK_EQ(-1.0, t.result0); | 2981 CHECK_EQ(minus_one, t.result0); |
2972 CHECK_EQ(1.0, t.result1); | 2982 CHECK_EQ(one, t.result1); |
2973 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 2983 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
2974 CHECK_EQ(-1.0, t.result2); | 2984 CHECK_EQ(minus_one, t.result2); |
2975 CHECK_EQ(1.0, t.result3); | 2985 CHECK_EQ(one, t.result3); |
2976 } | 2986 } |
2977 CHECK_EQ(3.0, t.result4); | 2987 CHECK_EQ(minus_one, t.result4); |
2978 CHECK_EQ(4.0, t.result5); | 2988 CHECK_EQ(minus_one, t.result5); |
2979 CHECK_EQ(1.0, t.result6); | 2989 CHECK_EQ(one, t.result6); |
2980 CHECK_EQ(2.0, t.result7); | 2990 CHECK_EQ(one, t.result7); |
jbramley
2016/11/30 17:38:05
I wonder if it's useful to use other values (like
bbudge
2016/11/30 19:15:18
Yes, good point. I'll put a non-FP test pattern in
| |
2981 } | 2991 } |
2982 | 2992 |
2983 TEST(regress4292_b) { | 2993 TEST(regress4292_b) { |
2984 CcTest::InitializeVM(); | 2994 CcTest::InitializeVM(); |
2985 Isolate* isolate = CcTest::i_isolate(); | 2995 Isolate* isolate = CcTest::i_isolate(); |
2986 HandleScope scope(isolate); | 2996 HandleScope scope(isolate); |
2987 | 2997 |
2988 Assembler assm(isolate, NULL, 0); | 2998 Assembler assm(isolate, NULL, 0); |
2989 Label end; | 2999 Label end; |
2990 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 3000 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3031 HandleScope scope(isolate); | 3041 HandleScope scope(isolate); |
3032 | 3042 |
3033 Assembler assm(isolate, NULL, 0); | 3043 Assembler assm(isolate, NULL, 0); |
3034 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 3044 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
3035 __ BlockConstPoolFor(1019); | 3045 __ BlockConstPoolFor(1019); |
3036 for (int i = 0; i < 1019; ++i) __ nop(); | 3046 for (int i = 0; i < 1019; ++i) __ nop(); |
3037 __ vldr(d0, MemOperand(r0, 0)); | 3047 __ vldr(d0, MemOperand(r0, 0)); |
3038 } | 3048 } |
3039 | 3049 |
3040 #undef __ | 3050 #undef __ |
OLD | NEW |