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() | lr.bit()); |
2934 __ vmov(d1, -1.0); | 2934 |
2935 __ mov(r4, Operand(0)); | |
2936 __ mov(r5, Operand(0x3FF00000)); | |
2937 __ mov(r6, Operand(0xBFF00000)); | |
jbramley
2016/11/30 10:41:08
`double_to_rawbits` could make this cleaner:
uint
bbudge
2016/11/30 11:34:14
I used bit_cast<uint64_t> since double_to_rawbits
| |
2938 __ vmov(d0, r4, r5); // d0 = 1.0 | |
2939 __ vmov(d1, r4, r6); // d1 = -1.0 | |
2935 __ vswp(d0, d1); | 2940 __ vswp(d0, d1); |
2936 __ vstr(d0, r0, offsetof(T, result0)); | 2941 __ vstr(d0, r0, offsetof(T, result0)); |
2937 __ vstr(d1, r0, offsetof(T, result1)); | 2942 __ vstr(d1, r0, offsetof(T, result1)); |
2938 | 2943 |
2939 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 2944 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
2940 __ vmov(d30, 1.0); | 2945 __ vmov(d30, r4, r5); // d30 = 1.0 |
2941 __ vmov(d31, -1.0); | 2946 __ vmov(d31, r4, r6); // d31 = -1.0 |
2942 __ vswp(d30, d31); | 2947 __ vswp(d30, d31); |
2943 __ vstr(d30, r0, offsetof(T, result2)); | 2948 __ vstr(d30, r0, offsetof(T, result2)); |
2944 __ vstr(d31, r0, offsetof(T, result3)); | 2949 __ vstr(d31, r0, offsetof(T, result3)); |
2945 } | 2950 } |
2946 | 2951 |
2947 // q-register swap. | 2952 // q-register swap. |
2948 __ vmov(d8, 1.0); | 2953 __ vmov(d8, r4, r5); |
2949 __ vmov(d9, 2.0); | 2954 __ vmov(d9, r4, r5); // q4 = [1.0, 1.0] |
2950 __ vmov(d10, 3.0); | 2955 __ vmov(d10, r4, r6); |
2951 __ vmov(d11, 4.0); | 2956 __ vmov(d11, r4, r6); // q5 = [-1.0, -1.0] |
2952 __ vswp(q4, q5); | 2957 __ vswp(q4, q5); |
2953 __ vstr(d8, r0, offsetof(T, result4)); | 2958 __ vstr(d8, r0, offsetof(T, result4)); |
2954 __ vstr(d9, r0, offsetof(T, result5)); | 2959 __ vstr(d9, r0, offsetof(T, result5)); |
2955 __ vstr(d10, r0, offsetof(T, result6)); | 2960 __ vstr(d10, r0, offsetof(T, result6)); |
2956 __ vstr(d11, r0, offsetof(T, result7)); | 2961 __ vstr(d11, r0, offsetof(T, result7)); |
2957 | 2962 |
2963 __ ldm(ia_w, sp, r4.bit() | r5.bit() | r6.bit() | pc.bit()); | |
2958 __ bx(lr); | 2964 __ bx(lr); |
2959 | 2965 |
2960 CodeDesc desc; | 2966 CodeDesc desc; |
2961 assm.GetCode(&desc); | 2967 assm.GetCode(&desc); |
2962 Handle<Code> code = isolate->factory()->NewCode( | 2968 Handle<Code> code = isolate->factory()->NewCode( |
2963 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 2969 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
2964 #ifdef DEBUG | 2970 #ifdef DEBUG |
2965 OFStream os(stdout); | 2971 OFStream os(stdout); |
2966 code->Print(os); | 2972 code->Print(os); |
2967 #endif | 2973 #endif |
2968 F3 f = FUNCTION_CAST<F3>(code->entry()); | 2974 F3 f = FUNCTION_CAST<F3>(code->entry()); |
2969 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); | 2975 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); |
2970 USE(dummy); | 2976 USE(dummy); |
2971 CHECK_EQ(-1.0, t.result0); | 2977 CHECK_EQ(0xBFF0000000000000u, t.result0); |
jbramley
2016/11/30 10:41:08
Nearby tests use lower-case hexadecimal. This shou
bbudge
2016/11/30 11:34:14
Or we can use the 'one' and 'minus_one' constants
| |
2972 CHECK_EQ(1.0, t.result1); | 2978 CHECK_EQ(0x3FF0000000000000u, t.result1); |
2973 if (CpuFeatures::IsSupported(VFP32DREGS)) { | 2979 if (CpuFeatures::IsSupported(VFP32DREGS)) { |
2974 CHECK_EQ(-1.0, t.result2); | 2980 CHECK_EQ(0xBFF0000000000000u, t.result2); |
2975 CHECK_EQ(1.0, t.result3); | 2981 CHECK_EQ(0x3FF0000000000000u, t.result3); |
2976 } | 2982 } |
2977 CHECK_EQ(3.0, t.result4); | 2983 CHECK_EQ(0xBFF0000000000000u, t.result4); |
2978 CHECK_EQ(4.0, t.result5); | 2984 CHECK_EQ(0xBFF0000000000000u, t.result5); |
2979 CHECK_EQ(1.0, t.result6); | 2985 CHECK_EQ(0x3FF0000000000000u, t.result6); |
2980 CHECK_EQ(2.0, t.result7); | 2986 CHECK_EQ(0x3FF0000000000000u, t.result7); |
2981 } | 2987 } |
2982 | 2988 |
2983 TEST(regress4292_b) { | 2989 TEST(regress4292_b) { |
2984 CcTest::InitializeVM(); | 2990 CcTest::InitializeVM(); |
2985 Isolate* isolate = CcTest::i_isolate(); | 2991 Isolate* isolate = CcTest::i_isolate(); |
2986 HandleScope scope(isolate); | 2992 HandleScope scope(isolate); |
2987 | 2993 |
2988 Assembler assm(isolate, NULL, 0); | 2994 Assembler assm(isolate, NULL, 0); |
2989 Label end; | 2995 Label end; |
2990 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 2996 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3031 HandleScope scope(isolate); | 3037 HandleScope scope(isolate); |
3032 | 3038 |
3033 Assembler assm(isolate, NULL, 0); | 3039 Assembler assm(isolate, NULL, 0); |
3034 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 3040 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
3035 __ BlockConstPoolFor(1019); | 3041 __ BlockConstPoolFor(1019); |
3036 for (int i = 0; i < 1019; ++i) __ nop(); | 3042 for (int i = 0; i < 1019; ++i) __ nop(); |
3037 __ vldr(d0, MemOperand(r0, 0)); | 3043 __ vldr(d0, MemOperand(r0, 0)); |
3038 } | 3044 } |
3039 | 3045 |
3040 #undef __ | 3046 #undef __ |
OLD | NEW |