Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1549)

Side by Side Diff: test/cctest/test-assembler-arm.cc

Issue 6874010: ARM: Optimisations for call, jump and untag.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 CHECK_EQ(8.0, f.b); 938 CHECK_EQ(8.0, f.b);
939 CHECK_EQ(1.0, f.c); 939 CHECK_EQ(1.0, f.c);
940 CHECK_EQ(2.0, f.d); 940 CHECK_EQ(2.0, f.d);
941 CHECK_EQ(3.0, f.e); 941 CHECK_EQ(3.0, f.e);
942 CHECK_EQ(4.0, f.f); 942 CHECK_EQ(4.0, f.f);
943 CHECK_EQ(5.0, f.g); 943 CHECK_EQ(5.0, f.g);
944 CHECK_EQ(6.0, f.h); 944 CHECK_EQ(6.0, f.h);
945 } 945 }
946 } 946 }
947 947
948
949 TEST(11) {
950 // Test instructions using the carry flag.
951 InitializeVM();
952 v8::HandleScope scope;
953
954 typedef struct {
955 int32_t a;
956 int32_t b;
957 int32_t c;
958 int32_t d;
959 } I;
960 I i;
961
962 i.a = 0xabcd0001;
963 i.b = 0xabcd0000;
964
965 Assembler assm(Isolate::Current(), NULL, 0);
966
967 // Test HeapObject untagging.
968 __ ldr(r1, MemOperand(r0, OFFSET_OF(I, a)));
969 __ mov(r1, Operand(r1, ASR, 1), SetCC);
970 __ adc(r1, r1, Operand(r1), LeaveCC, cs);
971 __ str(r1, MemOperand(r0, OFFSET_OF(I, a)));
972
973 __ ldr(r2, MemOperand(r0, OFFSET_OF(I, b)));
974 __ mov(r2, Operand(r2, ASR, 1), SetCC);
975 __ adc(r2, r2, Operand(r2), LeaveCC, cs);
976 __ str(r2, MemOperand(r0, OFFSET_OF(I, b)));
977
978 // Test corner cases.
979 __ mov(r1, Operand(0xffffffff));
980 __ mov(r2, Operand(0));
981 __ mov(r3, Operand(r1, ASR, 1), SetCC); // Set the carry.
982 __ adc(r3, r1, Operand(r2));
983 __ str(r3, MemOperand(r0, OFFSET_OF(I, c)));
984
985 __ mov(r1, Operand(0xffffffff));
986 __ mov(r2, Operand(0));
987 __ mov(r3, Operand(r2, ASR, 1), SetCC); // Unset the carry.
988 __ adc(r3, r1, Operand(r2));
989 __ str(r3, MemOperand(r0, OFFSET_OF(I, d)));
990
991 __ mov(pc, Operand(lr));
992
993 CodeDesc desc;
994 assm.GetCode(&desc);
995 Object* code = HEAP->CreateCode(
996 desc,
997 Code::ComputeFlags(Code::STUB),
998 Handle<Object>(HEAP->undefined_value()))->ToObjectChecked();
999 CHECK(code->IsCode());
1000 #ifdef DEBUG
1001 Code::cast(code)->Print();
1002 #endif
1003 F3 f = FUNCTION_CAST<F3>(Code::cast(code)->entry());
1004 Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0);
1005 USE(dummy);
1006
1007 CHECK_EQ(0xabcd0001, i.a);
1008 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b);
1009 CHECK_EQ(0x00000000, i.c);
1010 CHECK_EQ(0xffffffff, i.d);
1011 }
1012
948 #undef __ 1013 #undef __
OLDNEW
« no previous file with comments | « src/arm/simulator-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698