Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8279076

C2: Bad AD file when matching SqrtF with UseSSE=0

XMLWordPrintable

    • b30

        Reliably reproduces on x86_32 with vector tests, but the issue looks pre-existing.

        $ CONF=linux-x86-server-fastdebug make run-test TEST=jdk/incubator/vector/Float128VectorTests.java TEST_VM_OPTS="-XX:UseSSE=0 -XX:UseAVX=0"

        test Float128VectorTests.SINHFloat128VectorTests(float[cornerCaseValue(i)]): success
        o39 SqrtF === _ o12 [[o40 2 ]]

        --N: o39 SqrtF === _ o12 [[o40 2 ]]

           --N: o12 Parm === o3 [[o39 ]] Parm2: float
           REGFPR 0 REGFPR
           REGFPR1 0 REGFPR1
           REGF 100 MoveVL2F
           LEGREGF 200 MoveF2LEG
           VLREGF 0 VLREGF

        # To suppress the following error report, specify this argument
        # after -XX: or in .hotspotrc: SuppressErrorAt=/matcher.cpp:1716

        The current match rules are:

        // sqrtss instruction needs destination register to be pre initialized for best performance
        // Therefore only the instruct rule where the input is pre-loaded into dst register is defined below
        instruct sqrtF_reg(regF dst) %{
          predicate(UseSSE>=1);
          match(Set dst (SqrtF dst));
          format %{ "sqrtss $dst, $dst" %}
          ins_encode %{
            __ sqrtss($dst$$XMMRegister, $dst$$XMMRegister);
          %}
          ins_pipe(pipe_slow);
        %}

        The node is generated here:

        //------------------------------Ideal------------------------------------------
        // If we see pattern ConvF2D SomeDoubleOp ConvD2F, do operation as float.
        Node *ConvD2FNode::Ideal(PhaseGVN *phase, bool can_reshape) {
          if ( in(1)->Opcode() == Op_SqrtD ) {
            Node* sqrtd = in(1);
            if ( sqrtd->in(1)->Opcode() == Op_ConvF2D ) {
              if ( Matcher::match_rule_supported(Op_SqrtF) ) {
                Node* convf2d = sqrtd->in(1);
                return new SqrtFNode(phase->C, sqrtd->in(0), convf2d->in(1));
              }
            }
          }
          return NULL;
        }

        I actually thought Matcher::match_rule_supported looks at predicate(...) in the match rule above, but apparently it just hard-codes the exceptions! Op_SqrtF (and Op_SqrtD) should be handled there.

        This only affects x86_32, as x86_64 always runs with UseSSE >= 2.

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: