357 } |
357 } |
358 } |
358 } |
359 |
359 |
360 @MatchRule("(If (IntegerTest Read=access value))") |
360 @MatchRule("(If (IntegerTest Read=access value))") |
361 @MatchRule("(If (IntegerTest FloatingRead=access value))") |
361 @MatchRule("(If (IntegerTest FloatingRead=access value))") |
|
362 @MatchRule("(If (IntegerTest VolatileRead=access value))") |
362 public ComplexMatchResult integerTestBranchMemory(IfNode root, LIRLowerableAccess access, ValueNode value) { |
363 public ComplexMatchResult integerTestBranchMemory(IfNode root, LIRLowerableAccess access, ValueNode value) { |
363 return emitIntegerTestBranchMemory(root, value, access); |
364 return emitIntegerTestBranchMemory(root, value, access); |
364 } |
365 } |
365 |
366 |
366 @MatchRule("(If (IntegerEquals=compare value Read=access))") |
367 @MatchRule("(If (IntegerEquals=compare value Read=access))") |
367 @MatchRule("(If (IntegerLessThan=compare value Read=access))") |
368 @MatchRule("(If (IntegerLessThan=compare value Read=access))") |
368 @MatchRule("(If (IntegerBelow=compare value Read=access))") |
369 @MatchRule("(If (IntegerBelow=compare value Read=access))") |
369 @MatchRule("(If (IntegerEquals=compare value FloatingRead=access))") |
370 @MatchRule("(If (IntegerEquals=compare value FloatingRead=access))") |
370 @MatchRule("(If (IntegerLessThan=compare value FloatingRead=access))") |
371 @MatchRule("(If (IntegerLessThan=compare value FloatingRead=access))") |
371 @MatchRule("(If (IntegerBelow=compare value FloatingRead=access))") |
372 @MatchRule("(If (IntegerBelow=compare value FloatingRead=access))") |
|
373 @MatchRule("(If (IntegerEquals=compare value VolatileRead=access))") |
|
374 @MatchRule("(If (IntegerLessThan=compare value VolatileRead=access))") |
|
375 @MatchRule("(If (IntegerBelow=compare value VolatileRead=access))") |
372 @MatchRule("(If (FloatEquals=compare value Read=access))") |
376 @MatchRule("(If (FloatEquals=compare value Read=access))") |
373 @MatchRule("(If (FloatEquals=compare value FloatingRead=access))") |
377 @MatchRule("(If (FloatEquals=compare value FloatingRead=access))") |
|
378 @MatchRule("(If (FloatEquals=compare value VolatileRead=access))") |
374 @MatchRule("(If (FloatLessThan=compare value Read=access))") |
379 @MatchRule("(If (FloatLessThan=compare value Read=access))") |
375 @MatchRule("(If (FloatLessThan=compare value FloatingRead=access))") |
380 @MatchRule("(If (FloatLessThan=compare value FloatingRead=access))") |
|
381 @MatchRule("(If (FloatLessThan=compare value VolatileRead=access))") |
376 @MatchRule("(If (PointerEquals=compare value Read=access))") |
382 @MatchRule("(If (PointerEquals=compare value Read=access))") |
377 @MatchRule("(If (PointerEquals=compare value FloatingRead=access))") |
383 @MatchRule("(If (PointerEquals=compare value FloatingRead=access))") |
|
384 @MatchRule("(If (PointerEquals=compare value VolatileRead=access))") |
378 @MatchRule("(If (ObjectEquals=compare value Read=access))") |
385 @MatchRule("(If (ObjectEquals=compare value Read=access))") |
379 @MatchRule("(If (ObjectEquals=compare value FloatingRead=access))") |
386 @MatchRule("(If (ObjectEquals=compare value FloatingRead=access))") |
|
387 @MatchRule("(If (ObjectEquals=compare value VolatileRead=access))") |
380 public ComplexMatchResult ifCompareMemory(IfNode root, CompareNode compare, ValueNode value, LIRLowerableAccess access) { |
388 public ComplexMatchResult ifCompareMemory(IfNode root, CompareNode compare, ValueNode value, LIRLowerableAccess access) { |
381 return emitCompareBranchMemory(root, compare, value, access); |
389 return emitCompareBranchMemory(root, compare, value, access); |
382 } |
390 } |
383 |
391 |
384 @MatchRule("(If (ObjectEquals=compare value ValueCompareAndSwap=cas))") |
392 @MatchRule("(If (ObjectEquals=compare value ValueCompareAndSwap=cas))") |
476 getState(access)); |
484 getState(access)); |
477 } |
485 } |
478 |
486 |
479 @MatchRule("(Add value Read=access)") |
487 @MatchRule("(Add value Read=access)") |
480 @MatchRule("(Add value FloatingRead=access)") |
488 @MatchRule("(Add value FloatingRead=access)") |
|
489 @MatchRule("(Add value VolatileRead=access)") |
481 public ComplexMatchResult addMemory(ValueNode value, LIRLowerableAccess access) { |
490 public ComplexMatchResult addMemory(ValueNode value, LIRLowerableAccess access) { |
482 OperandSize size = getMemorySize(access); |
491 OperandSize size = getMemorySize(access); |
483 if (size.isXmmType()) { |
492 if (size.isXmmType()) { |
484 if (getArithmeticLIRGenerator().supportAVX()) { |
493 if (getArithmeticLIRGenerator().supportAVX()) { |
485 return binaryRead(size == SS ? VADDSS : VADDSD, size, value, access); |
494 return binaryRead(size == SS ? VADDSS : VADDSD, size, value, access); |
491 } |
500 } |
492 } |
501 } |
493 |
502 |
494 @MatchRule("(Sub value Read=access)") |
503 @MatchRule("(Sub value Read=access)") |
495 @MatchRule("(Sub value FloatingRead=access)") |
504 @MatchRule("(Sub value FloatingRead=access)") |
|
505 @MatchRule("(Sub value VolatileRead=access)") |
496 public ComplexMatchResult subMemory(ValueNode value, LIRLowerableAccess access) { |
506 public ComplexMatchResult subMemory(ValueNode value, LIRLowerableAccess access) { |
497 OperandSize size = getMemorySize(access); |
507 OperandSize size = getMemorySize(access); |
498 if (size.isXmmType()) { |
508 if (size.isXmmType()) { |
499 if (getArithmeticLIRGenerator().supportAVX()) { |
509 if (getArithmeticLIRGenerator().supportAVX()) { |
500 return binaryRead(size == SS ? VSUBSS : VSUBSD, size, value, access); |
510 return binaryRead(size == SS ? VSUBSS : VSUBSD, size, value, access); |
506 } |
516 } |
507 } |
517 } |
508 |
518 |
509 @MatchRule("(Mul value Read=access)") |
519 @MatchRule("(Mul value Read=access)") |
510 @MatchRule("(Mul value FloatingRead=access)") |
520 @MatchRule("(Mul value FloatingRead=access)") |
|
521 @MatchRule("(Mul value VolatileRead=access)") |
511 public ComplexMatchResult mulMemory(ValueNode value, LIRLowerableAccess access) { |
522 public ComplexMatchResult mulMemory(ValueNode value, LIRLowerableAccess access) { |
512 OperandSize size = getMemorySize(access); |
523 OperandSize size = getMemorySize(access); |
513 if (size.isXmmType()) { |
524 if (size.isXmmType()) { |
514 if (getArithmeticLIRGenerator().supportAVX()) { |
525 if (getArithmeticLIRGenerator().supportAVX()) { |
515 return binaryRead(size == SS ? VMULSS : VMULSD, size, value, access); |
526 return binaryRead(size == SS ? VMULSS : VMULSD, size, value, access); |
563 }; |
577 }; |
564 } |
578 } |
565 |
579 |
566 @MatchRule("(SignExtend Read=access)") |
580 @MatchRule("(SignExtend Read=access)") |
567 @MatchRule("(SignExtend FloatingRead=access)") |
581 @MatchRule("(SignExtend FloatingRead=access)") |
|
582 @MatchRule("(SignExtend VolatileRead=access)") |
568 public ComplexMatchResult signExtend(SignExtendNode root, LIRLowerableAccess access) { |
583 public ComplexMatchResult signExtend(SignExtendNode root, LIRLowerableAccess access) { |
569 return emitSignExtendMemory(access, root.getInputBits(), root.getResultBits(), null); |
584 return emitSignExtendMemory(access, root.getInputBits(), root.getResultBits(), null); |
570 } |
585 } |
571 |
586 |
572 @MatchRule("(ZeroExtend Read=access)") |
587 @MatchRule("(ZeroExtend Read=access)") |
573 @MatchRule("(ZeroExtend FloatingRead=access)") |
588 @MatchRule("(ZeroExtend FloatingRead=access)") |
|
589 @MatchRule("(ZeroExtend VolatileRead=access)") |
574 public ComplexMatchResult zeroExtend(ZeroExtendNode root, LIRLowerableAccess access) { |
590 public ComplexMatchResult zeroExtend(ZeroExtendNode root, LIRLowerableAccess access) { |
575 AMD64Kind memoryKind = getMemoryKind(access); |
591 AMD64Kind memoryKind = getMemoryKind(access); |
576 return builder -> getArithmeticLIRGenerator().emitZeroExtendMemory(memoryKind, root.getResultBits(), (AMD64AddressValue) operand(access.getAddress()), getState(access)); |
592 return builder -> getArithmeticLIRGenerator().emitZeroExtendMemory(memoryKind, root.getResultBits(), (AMD64AddressValue) operand(access.getAddress()), getState(access)); |
577 } |
593 } |
578 |
594 |
579 @MatchRule("(Narrow Read=access)") |
595 @MatchRule("(Narrow Read=access)") |
580 @MatchRule("(Narrow FloatingRead=access)") |
596 @MatchRule("(Narrow FloatingRead=access)") |
|
597 @MatchRule("(Narrow VolatileRead=access)") |
581 public ComplexMatchResult narrowRead(NarrowNode root, LIRLowerableAccess access) { |
598 public ComplexMatchResult narrowRead(NarrowNode root, LIRLowerableAccess access) { |
582 return new ComplexMatchResult() { |
599 return new ComplexMatchResult() { |
583 @Override |
600 @Override |
584 public Value evaluate(NodeLIRBuilder builder) { |
601 public Value evaluate(NodeLIRBuilder builder) { |
585 AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress()); |
602 AMD64AddressValue address = (AMD64AddressValue) operand(access.getAddress()); |
593 }; |
610 }; |
594 } |
611 } |
595 |
612 |
596 @MatchRule("(SignExtend (Narrow=narrow Read=access))") |
613 @MatchRule("(SignExtend (Narrow=narrow Read=access))") |
597 @MatchRule("(SignExtend (Narrow=narrow FloatingRead=access))") |
614 @MatchRule("(SignExtend (Narrow=narrow FloatingRead=access))") |
|
615 @MatchRule("(SignExtend (Narrow=narrow VolatileRead=access))") |
598 public ComplexMatchResult signExtendNarrowRead(SignExtendNode root, NarrowNode narrow, LIRLowerableAccess access) { |
616 public ComplexMatchResult signExtendNarrowRead(SignExtendNode root, NarrowNode narrow, LIRLowerableAccess access) { |
599 LIRKind kind = getLIRGeneratorTool().getLIRKind(narrow.stamp(NodeView.DEFAULT)); |
617 LIRKind kind = getLIRGeneratorTool().getLIRKind(narrow.stamp(NodeView.DEFAULT)); |
600 return emitSignExtendMemory(access, narrow.getResultBits(), root.getResultBits(), kind); |
618 return emitSignExtendMemory(access, narrow.getResultBits(), root.getResultBits(), kind); |
601 } |
619 } |
602 |
620 |
603 @MatchRule("(FloatConvert Read=access)") |
621 @MatchRule("(FloatConvert Read=access)") |
604 @MatchRule("(FloatConvert FloatingRead=access)") |
622 @MatchRule("(FloatConvert FloatingRead=access)") |
|
623 @MatchRule("(FloatConvert VolatileRead=access)") |
605 public ComplexMatchResult floatConvert(FloatConvertNode root, LIRLowerableAccess access) { |
624 public ComplexMatchResult floatConvert(FloatConvertNode root, LIRLowerableAccess access) { |
606 switch (root.getFloatConvert()) { |
625 switch (root.getFloatConvert()) { |
607 case D2F: |
626 case D2F: |
608 return emitConvertMemoryOp(AMD64Kind.SINGLE, SSEOp.CVTSD2SS, SD, access); |
627 return emitConvertMemoryOp(AMD64Kind.SINGLE, SSEOp.CVTSD2SS, SD, access); |
609 case D2I: |
628 case D2I: |
629 } |
648 } |
630 } |
649 } |
631 |
650 |
632 @MatchRule("(Reinterpret Read=access)") |
651 @MatchRule("(Reinterpret Read=access)") |
633 @MatchRule("(Reinterpret FloatingRead=access)") |
652 @MatchRule("(Reinterpret FloatingRead=access)") |
|
653 @MatchRule("(Reinterpret VolatileRead=access)") |
634 public ComplexMatchResult reinterpret(ReinterpretNode root, LIRLowerableAccess access) { |
654 public ComplexMatchResult reinterpret(ReinterpretNode root, LIRLowerableAccess access) { |
635 return builder -> { |
655 return builder -> { |
636 LIRKind kind = getLIRGeneratorTool().getLIRKind(root.stamp(NodeView.DEFAULT)); |
656 LIRKind kind = getLIRGeneratorTool().getLIRKind(root.stamp(NodeView.DEFAULT)); |
637 return emitReinterpretMemory(kind, access); |
657 return emitReinterpretMemory(kind, access); |
638 }; |
658 }; |