Mercurial > hg > truffle
comparison src/cpu/ppc/vm/vm_version_ppc.cpp @ 17807:71a71b0bc844
8037915: PPC64/AIX: Several smaller fixes
Reviewed-by: kvn
author | goetz |
---|---|
date | Thu, 20 Mar 2014 11:03:06 +0100 |
parents | 31e80afe3fed |
children | 78bbf4d43a14 |
comparison
equal
deleted
inserted
replaced
17806:9200402b42d5 | 17807:71a71b0bc844 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2012, 2013 SAP AG. All rights reserved. | 3 * Copyright 2012, 2014 SAP AG. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 5 * |
6 * This code is free software; you can redistribute it and/or modify it | 6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as | 7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. | 8 * published by the Free Software Foundation. |
400 // Allocate space for the code. | 400 // Allocate space for the code. |
401 ResourceMark rm; | 401 ResourceMark rm; |
402 CodeBuffer cb("detect_cpu_features", code_size, 0); | 402 CodeBuffer cb("detect_cpu_features", code_size, 0); |
403 MacroAssembler* a = new MacroAssembler(&cb); | 403 MacroAssembler* a = new MacroAssembler(&cb); |
404 | 404 |
405 // Must be set to true so we can generate the test code. | |
406 _features = VM_Version::all_features_m; | |
407 | |
405 // Emit code. | 408 // Emit code. |
406 void (*test)(address addr, uint64_t offset)=(void(*)(address addr, uint64_t offset))(void *)a->function_entry(); | 409 void (*test)(address addr, uint64_t offset)=(void(*)(address addr, uint64_t offset))(void *)a->function_entry(); |
407 uint32_t *code = (uint32_t *)a->pc(); | 410 uint32_t *code = (uint32_t *)a->pc(); |
408 // Don't use R0 in ldarx. | 411 // Don't use R0 in ldarx. |
409 // Keep R3_ARG1 unmodified, it contains &field (see below). | 412 // Keep R3_ARG1 unmodified, it contains &field (see below). |
410 // Keep R4_ARG2 unmodified, it contains offset = 0 (see below). | 413 // Keep R4_ARG2 unmodified, it contains offset = 0 (see below). |
411 a->fsqrt(F3, F4); // code[0] -> fsqrt_m | 414 a->fsqrt(F3, F4); // code[0] -> fsqrt_m |
412 a->isel(R7, R5, R6, 0); // code[1] -> isel_m | 415 a->fsqrts(F3, F4); // code[1] -> fsqrts_m |
413 a->ldarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[2] -> lxarx_m | 416 a->isel(R7, R5, R6, 0); // code[2] -> isel_m |
414 a->cmpb(R7, R5, R6); // code[3] -> bcmp | 417 a->ldarx_unchecked(R7, R3_ARG1, R4_ARG2, 1); // code[3] -> lxarx_m |
415 //a->mftgpr(R7, F3); // code[4] -> mftgpr | 418 a->cmpb(R7, R5, R6); // code[4] -> bcmp |
416 a->popcntb(R7, R5); // code[5] -> popcntb | 419 //a->mftgpr(R7, F3); // code[5] -> mftgpr |
417 a->popcntw(R7, R5); // code[6] -> popcntw | 420 a->popcntb(R7, R5); // code[6] -> popcntb |
418 a->fcfids(F3, F4); // code[7] -> fcfids | 421 a->popcntw(R7, R5); // code[7] -> popcntw |
419 a->vand(VR0, VR0, VR0); // code[8] -> vand | 422 a->fcfids(F3, F4); // code[8] -> fcfids |
423 a->vand(VR0, VR0, VR0); // code[9] -> vand | |
420 a->blr(); | 424 a->blr(); |
421 | 425 |
422 // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it. | 426 // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it. |
423 void (*zero_cacheline_func_ptr)(char*) = (void(*)(char*))(void *)a->function_entry(); | 427 void (*zero_cacheline_func_ptr)(char*) = (void(*)(char*))(void *)a->function_entry(); |
424 a->dcbz(R3_ARG1); // R3_ARG1 = addr | 428 a->dcbz(R3_ARG1); // R3_ARG1 = addr |
425 a->blr(); | 429 a->blr(); |
426 | 430 |
427 uint32_t *code_end = (uint32_t *)a->pc(); | 431 uint32_t *code_end = (uint32_t *)a->pc(); |
428 a->flush(); | 432 a->flush(); |
433 _features = VM_Version::unknown_m; | |
429 | 434 |
430 // Print the detection code. | 435 // Print the detection code. |
431 if (PrintAssembly) { | 436 if (PrintAssembly) { |
432 ttyLocker ttyl; | 437 ttyLocker ttyl; |
433 tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " before execution:", code); | 438 tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " before execution:", code); |
448 VM_Version::_is_determine_features_test_running = false; | 453 VM_Version::_is_determine_features_test_running = false; |
449 | 454 |
450 // determine which instructions are legal. | 455 // determine which instructions are legal. |
451 int feature_cntr = 0; | 456 int feature_cntr = 0; |
452 if (code[feature_cntr++]) features |= fsqrt_m; | 457 if (code[feature_cntr++]) features |= fsqrt_m; |
458 if (code[feature_cntr++]) features |= fsqrts_m; | |
453 if (code[feature_cntr++]) features |= isel_m; | 459 if (code[feature_cntr++]) features |= isel_m; |
454 if (code[feature_cntr++]) features |= lxarxeh_m; | 460 if (code[feature_cntr++]) features |= lxarxeh_m; |
455 if (code[feature_cntr++]) features |= cmpb_m; | 461 if (code[feature_cntr++]) features |= cmpb_m; |
456 //if(code[feature_cntr++])features |= mftgpr_m; | 462 //if(code[feature_cntr++])features |= mftgpr_m; |
457 if (code[feature_cntr++]) features |= popcntb_m; | 463 if (code[feature_cntr++]) features |= popcntb_m; |