Bug 81643 - FAIL: gcc.target/aarch64/long_branch_1.c scan-assembler Ltb
Summary: FAIL: gcc.target/aarch64/long_branch_1.c scan-assembler Ltb
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-01 10:42 UTC by bin cheng
Modified: 2017-09-13 16:58 UTC (History)
1 user (show)

See Also:
Host:
Target: aarch64
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-08-01 00:00:00


Attachments
Assembly before (50.20 KB, application/x-bzip)
2017-08-01 11:38 UTC, Martin Liška
Details
Assembly after (50.24 KB, application/x-bzip)
2017-08-01 11:39 UTC, Martin Liška
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bin cheng 2017-08-01 10:42:40 UTC
The test failed on aarch64-none-elf, aarch64-none-linux-gnu, aarch64_be-none-elf,
looks like because of:
commit 38ef3642f7cce23012fc1126e292aa1a7285f849
Author: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Jul 31 11:16:00 2017 +0000

    Recover GOTO predictor.
    
    2017-07-31  Jan Hubicka <hubicka@ucw.cz>
            Martin Liska  <mliska@suse.cz>
    
        * c-typeck.c (c_finish_goto_label): Build gimple predict
        stament.
    2017-07-31  Jan Hubicka <hubicka@ucw.cz>
            Martin Liska  <mliska@suse.cz>
    
        * predict.def: Remove old comment and adjust probability.
        * gimplify.c (should_warn_for_implicit_fallthrough): Ignore
        PREDICT statements.
    2017-07-31  Jan Hubicka <hubicka@ucw.cz>
            Martin Liska  <mliska@suse.cz>
    
        * gcc.dg/predict-15.c: New test.
        * gcc.dg/tree-ssa/vrp24.c: Update scanned pattern.
    2017-07-31  Jan Hubicka <hubicka@ucw.cz>
            Martin Liska  <mliska@suse.cz>
    
        * pt.c (tsubst_copy): Copy PREDICT_EXPR.
        * semantics.c (finish_goto_stmt): Build gimple predict
        stament.
        * constexpr.c (potential_constant_expression_1): Handle
        PREDICT_EXPR.
    
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250737 138bc75d-0d04-0410-961f-82ee72b054a4
Comment 1 Martin Liška 2017-08-01 11:38:53 UTC
Created attachment 41880 [details]
Assembly before
Comment 2 Martin Liška 2017-08-01 11:39:21 UTC
Created attachment 41881 [details]
Assembly after
Comment 3 Martin Liška 2017-08-01 11:42:12 UTC
Confirmed that
/* { dg-final { scan-assembler "Ltb" } } */

is missing after the revision. Can you amker please tell me how the test works?
Comment 4 bin cheng 2017-08-01 11:49:38 UTC
(In reply to Martin Liška from comment #3)
> Confirmed that
> /* { dg-final { scan-assembler "Ltb" } } */
> 
> is missing after the revision. Can you amker please tell me how the test
> works?

It's from auto testing, I will try to reproduce it and update here.
Comment 5 bin cheng 2017-08-08 10:44:19 UTC
(In reply to Martin Liška from comment #3)
> Confirmed that
> /* { dg-final { scan-assembler "Ltb" } } */
> 
> is missing after the revision. Can you amker please tell me how the test
> works?

I don't know the details either.  Looks like it tests correct code generation for long distance conditional jump.  With the change, one type of long distance jump disappeared thus no relevant code is generated.  I guess this requires a test case change.  CCing AArch64 maintainer.
Comment 6 Steve Ellcey 2017-08-09 23:17:47 UTC
This is caused by adding the predict statement in finish_goto_label (c/c-typeck.c).  I tried to modify the test case to generate an Ltb label again
but could not do it.

I put an abort in aarch64_gen_far_branch for anytime an Ltb label was generated
but after doing a bootstrap and a full testsuite run never hit the abort.

I tried writing a new testsuite from scratch but again, could not generate an
Ltb label.

I am thinking that maybe we should just remove the Ltb check from the test case.
Comment 7 Martin Liška 2017-08-10 07:18:28 UTC
>
> I am thinking that maybe we should just remove the Ltb check from the test
> case.

Feel free to do it ;)
Comment 8 Wilco 2017-08-15 17:27:53 UTC
Fixed
Comment 9 Aldy Hernandez 2017-09-13 16:58:11 UTC
Author: aldyh
Date: Wed Sep 13 16:57:39 2017
New Revision: 252426

URL: https://gcc.gnu.org/viewcvs?rev=252426&root=gcc&view=rev
Log:
[AArch64] Fix longbranch test

Fix longbranch test so it still generates long tbz branches.

    gcc/testsuite/
	PR target/81643
	* gcc.target/aarch64/long_branch_1.c: Improve testcase.

Modified:
    branches/range-gen2/gcc/testsuite/ChangeLog
    branches/range-gen2/gcc/testsuite/gcc.target/aarch64/long_branch_1.c