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 vswp_d0; |
2923 double result1; | 2923 uint64_t vswp_d1; |
2924 double result2; | 2924 uint64_t vswp_d30; |
2925 double result3; | 2925 uint64_t vswp_d31; |
2926 double result4; | 2926 uint32_t vswp_q4[4]; |
2927 double result5; | 2927 uint32_t vswp_q5[4]; |
2928 double result6; | |
2929 double result7; | |
2930 } T; | 2928 } T; |
2931 T t; | 2929 T t; |
2932 | 2930 |
2933 __ vmov(d0, 1.0); | 2931 __ stm(db_w, sp, r4.bit() | r5.bit() | r6.bit() | r7.bit() | lr.bit()); |
2934 __ vmov(d1, -1.0); | 2932 |
| 2933 uint64_t one = bit_cast<uint64_t>(1.0); |
| 2934 __ mov(r5, Operand(one >> 32)); |
| 2935 __ mov(r4, Operand(one & 0xffffffff)); |
| 2936 uint64_t minus_one = bit_cast<uint64_t>(-1.0); |
| 2937 __ mov(r7, Operand(minus_one >> 32)); |
| 2938 __ mov(r6, Operand(minus_one & 0xffffffff)); |
| 2939 |
| 2940 __ vmov(d0, r4, r5); // d0 = 1.0 |
| 2941 __ vmov(d1, r6, r7); // d1 = -1.0 |
2935 __ vswp(d0, d1); | 2942 __ vswp(d0, d1); |
2936 __ vstr(d0, r0, offsetof(T, result0)); | 2943 __ vstr(d0, r0, offsetof(T, vswp_d0)); |
2937 __ vstr(d1, r0, offsetof(T, result1)); | 2944 __ vstr(d1, r0, offsetof(T, vswp_d1)); |
2938 | 2945 |
2939 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 2946 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
2940 __ vmov(d30, 1.0); | 2947 __ vmov(d30, r4, r5); // d30 = 1.0 |
2941 __ vmov(d31, -1.0); | 2948 __ vmov(d31, r6, r7); // d31 = -1.0 |
2942 __ vswp(d30, d31); | 2949 __ vswp(d30, d31); |
2943 __ vstr(d30, r0, offsetof(T, result2)); | 2950 __ vstr(d30, r0, offsetof(T, vswp_d30)); |
2944 __ vstr(d31, r0, offsetof(T, result3)); | 2951 __ vstr(d31, r0, offsetof(T, vswp_d31)); |
2945 } | 2952 } |
2946 | 2953 |
2947 // q-register swap. | 2954 // q-register swap. |
2948 __ vmov(d8, 1.0); | 2955 const uint32_t test_1 = 0x01234567; |
2949 __ vmov(d9, 2.0); | 2956 const uint32_t test_2 = 0x89abcdef; |
2950 __ vmov(d10, 3.0); | 2957 __ mov(r4, Operand(test_1)); |
2951 __ vmov(d11, 4.0); | 2958 __ mov(r5, Operand(test_2)); |
| 2959 // TODO(bbudge) replace with vdup when implemented. |
| 2960 __ vmov(d8, r4, r4); |
| 2961 __ vmov(d9, r4, r4); // q4 = [1.0, 1.0] |
| 2962 __ vmov(d10, r5, r5); |
| 2963 __ vmov(d11, r5, r5); // q5 = [-1.0, -1.0] |
2952 __ vswp(q4, q5); | 2964 __ vswp(q4, q5); |
2953 __ vstr(d8, r0, offsetof(T, result4)); | 2965 __ add(r6, r0, Operand(static_cast<int32_t>(offsetof(T, vswp_q4)))); |
2954 __ vstr(d9, r0, offsetof(T, result5)); | 2966 __ vst1(Neon8, NeonListOperand(d8, 2), NeonMemOperand(r6)); |
2955 __ vstr(d10, r0, offsetof(T, result6)); | 2967 __ add(r6, r0, Operand(static_cast<int32_t>(offsetof(T, vswp_q5)))); |
2956 __ vstr(d11, r0, offsetof(T, result7)); | 2968 __ vst1(Neon8, NeonListOperand(d10, 2), NeonMemOperand(r6)); |
2957 | 2969 |
| 2970 __ ldm(ia_w, sp, r4.bit() | r5.bit() | r6.bit() | r7.bit() | pc.bit()); |
2958 __ bx(lr); | 2971 __ bx(lr); |
2959 | 2972 |
2960 CodeDesc desc; | 2973 CodeDesc desc; |
2961 assm.GetCode(&desc); | 2974 assm.GetCode(&desc); |
2962 Handle<Code> code = isolate->factory()->NewCode( | 2975 Handle<Code> code = isolate->factory()->NewCode( |
2963 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 2976 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
2964 #ifdef DEBUG | 2977 #ifdef DEBUG |
2965 OFStream os(stdout); | 2978 OFStream os(stdout); |
2966 code->Print(os); | 2979 code->Print(os); |
2967 #endif | 2980 #endif |
2968 F3 f = FUNCTION_CAST<F3>(code->entry()); | 2981 F3 f = FUNCTION_CAST<F3>(code->entry()); |
2969 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); | 2982 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); |
2970 USE(dummy); | 2983 USE(dummy); |
2971 CHECK_EQ(-1.0, t.result0); | 2984 CHECK_EQ(minus_one, t.vswp_d0); |
2972 CHECK_EQ(1.0, t.result1); | 2985 CHECK_EQ(one, t.vswp_d1); |
2973 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 2986 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
2974 CHECK_EQ(-1.0, t.result2); | 2987 CHECK_EQ(minus_one, t.vswp_d30); |
2975 CHECK_EQ(1.0, t.result3); | 2988 CHECK_EQ(one, t.vswp_d31); |
2976 } | 2989 } |
2977 CHECK_EQ(3.0, t.result4); | 2990 CHECK_EQ(t.vswp_q4[0], test_2); |
2978 CHECK_EQ(4.0, t.result5); | 2991 CHECK_EQ(t.vswp_q4[1], test_2); |
2979 CHECK_EQ(1.0, t.result6); | 2992 CHECK_EQ(t.vswp_q4[2], test_2); |
2980 CHECK_EQ(2.0, t.result7); | 2993 CHECK_EQ(t.vswp_q4[3], test_2); |
| 2994 CHECK_EQ(t.vswp_q5[0], test_1); |
| 2995 CHECK_EQ(t.vswp_q5[1], test_1); |
| 2996 CHECK_EQ(t.vswp_q5[2], test_1); |
| 2997 CHECK_EQ(t.vswp_q5[3], test_1); |
2981 } | 2998 } |
2982 | 2999 |
2983 TEST(regress4292_b) { | 3000 TEST(regress4292_b) { |
2984 CcTest::InitializeVM(); | 3001 CcTest::InitializeVM(); |
2985 Isolate* isolate = CcTest::i_isolate(); | 3002 Isolate* isolate = CcTest::i_isolate(); |
2986 HandleScope scope(isolate); | 3003 HandleScope scope(isolate); |
2987 | 3004 |
2988 Assembler assm(isolate, NULL, 0); | 3005 Assembler assm(isolate, NULL, 0); |
2989 Label end; | 3006 Label end; |
2990 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 3007 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 HandleScope scope(isolate); | 3048 HandleScope scope(isolate); |
3032 | 3049 |
3033 Assembler assm(isolate, NULL, 0); | 3050 Assembler assm(isolate, NULL, 0); |
3034 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 3051 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
3035 __ BlockConstPoolFor(1019); | 3052 __ BlockConstPoolFor(1019); |
3036 for (int i = 0; i < 1019; ++i) __ nop(); | 3053 for (int i = 0; i < 1019; ++i) __ nop(); |
3037 __ vldr(d0, MemOperand(r0, 0)); | 3054 __ vldr(d0, MemOperand(r0, 0)); |
3038 } | 3055 } |
3039 | 3056 |
3040 #undef __ | 3057 #undef __ |
OLD | NEW |