diff options
author | Bernd Schmidt <bernd.schmidt@analog.com> | 2006-01-11 17:40:46 +0000 |
---|---|---|
committer | Bernd Schmidt <bernd.schmidt@analog.com> | 2006-01-11 17:40:46 +0000 |
commit | 337db89251de80f8ff7a00b2d71bc333c630b6e4 (patch) | |
tree | d3188ec1672ccdf9f1225cc766a1dc386c4f0d32 /gcc/config/alpha/sync.md | |
parent | efb5461014d0abdd5751d82ad1b4d0c61685dbdd (diff) |
Merged revisions 96681,96683-96686,96689-96692,96698-96701,96705,96708,96710,96712,96714-96715,96719-96720,96725,96730,96733,96735-96737,96739-96740,96743,96745,96748,96753,96755,96759-96762,96764-96765,96768,96770-96771,96774,96776-96778,96782,96784-96785,96788,96790,96795-96803,96808,96812-96814,96816-96832,96834,96836-96837,96844,96847,96849-96853,96855,96862,96867,96870,96872,96879-96881,96883-96884,96889,96891-96895,96899,96902-96905,96908,96911,96913,96915-96917,96919-96921,96923-96924,96926-96927,96931-96935,96937-96939,96941,96944,96947-96948,96951,96953-96954,96957-96958,96960,96963,96966-96968,96980-96985,96988-96990,96995-96996,96998,97000,97003-97005,97013-97016,97018-97019,97024,97026,97028-97029,97031-97034,97036,97038-97039,97041,97044,97046-97048,97050,97054,97057-97063,97065,97070,97074,97076-97077,97079,97081-97086,97089,97091,97109,97111-97116,97120,97122-97123,97125-97130,97132-97136,97139,97143,97146-97148,97150-97153,97156-97157,97160-97161,97164-97192,97194-97197,97199-97200,97202,97204,97207-97212,97217,97220-97223,97229,97233,97236-97243,97249-97253,97255,97258,97263-97264,97267,97270,97273,97276-97278,97281-97285,97287,97289-97290,97292,97295,97298-97299,97301,97303,97308,97312-97314,97317-97319,97321-97322,97325-97326,97330-97334,97336-97344,97347-97349,97351-97352,97358,97360-97364,97367,97369-97370,97372-97373,97376-97381,97383,97385-97397,97399-97400,97402-97403,97406,97409,97411-97412,97414,97416-97417,97422,97424,97428-97430,97434-97438,97440-97441,97444,97446,97449,97452-97453,97455-97458,97461,97470,97472-97473,97475-97476,97478-97479,97481,97484-97486,97489-97493,97495-97496,97498,97511,97522,97525-97527,97529,97532-97533,97536-97538,97540-97551,97554-97555,97557-97558,97560-97561,97565,97567,97569-97572,97574-97578,97580-97582,97587,97589,97593-97599,97601-97602,97604-97605,97607,97609,97611,97613,97617,97620,97622,97624,97627,97631,97633,97635-97636,97640-97641,97643-97646,97648,97650,97652-97656,97659-97663,97666,97668,97671,97673-97674,97676-97678,97681,97685-97686,97691,97694,97696,97699-97702,97705,97708-97713,97719,97722-97723,97726,97728,97730-97731,97733,97737-97740,97742,97746-97747,97749,97751,97756,97759-97760,97763,97765,97770,97772-97773,97775,97778-97779,97781-97782,97784,97787-97788,97790,97792-97793,97795-97797,97804-97805,97807-97810,97813,97815-97819,97822,97825-97828,97830,97832,97836-97842,97846,97849,97851,97854,97857,97860-97862,97866,97868-97873,97880,97884-97887,97890,97894-97895,97897,97902-97908,97910-97912,97916,97919-97924,97928-97932,97935,97937-97941,97943-97951,97955,97958,97961,97964-97966,97968,97971-97974,97976-97983,97986-97988,97991,97994,97999-98001,98003,98009-98010,98012,98017-98023,98026-98029,98031-98032,98034,98039-98040,98044,98047-98048,98051-98053,98058,98061-98068,98070-98073,98076-98080,98082-98095,98097,98099,98101-98107,98110-98111,98118,98121,98127-98128,98131-98137,98140-98144,98146,98148-98149,98152,98154-98156,98159,98161-98162,98165-98168,98173-98174,98179,98183-98184,98186-98187,98189-98193,98195-98196,98199-98200,98202-98203,98206,98208-98210,98213,98216,98218,98220-98223,98225,98227,98232-98234,98236-98239,98242,98244-98245,98247,98252,98257-98260,98262,98265-98266,98269,98271,98273,98278,98283,98285-98288,98295,98297,98303,98307,98309-98313,98315-98316,98318-98321,98323-98324,98326-98335,98338-98343,98345-98350,98352,98355,98357,98362,98365-98379,98381,98384-98400,98402-98403,98405-98408,98412-98414,98416-98421,98425,98428-98430,98432-98451,98453,98456-98458,98460-98462,98464,98466,98468-98469,98471-98473,98476,98478,98482,98486,98493-98504,98507-98508,98510-98511,98513-98519,98522-98523,98527-98528,98530,98534,98540,98542-98544,98548-98551,98555,98559-98562,98567,98569-98570,98573-98574,98578-98583,98585-98587,98589,98594,98596-98603,98605-98607,98610-98611,98613-98622,98624,98631-98637,98640,98643-98644,98649-98650,98654,98658-98660,98663-98665,98668-98669,98673-98674,98676,98678-98679,98681,98684-98686,98691,98693-98695,98699,98708,98711-98712,98714-98715,98717,98723-98724,98726,98728,98730-98735,98737-98738,98740,98744-98746,98749,98752-98753,98755-98756,98762-98771,98774-98776,98778-98780,98782-98783,98785-98786,98788-98789,98791-98793,98795-98798,98800,98805,98808,98813-98814,98816-98818,98828-98829,98831-98832,98835-98837,98840,98843-98845,98848,98850-98854,98861-98862,98866-98868,98871-98875,98877-98886,98890,98893,98896,98898,98900-98901,98906-98908,98910-98916,98919,98922,98924,98928-98929,98932,98934-98936,98938-98942,98944,98947,98949-98950,98952,98955,98958,98961-98962,98966,98968,98975-98981,98983-98989,98991-98994,98998-99000,99006,99008,99010-99013,99016,99018-99021,99028,99032-99033,99035,99037-99038,99041,99043,99046-99047,99052,99054,99059,99064,99067-99068,99071-99072,99076,99080,99082-99083,99085-99086,99089,99091,99093-99096,99099-99100,99103-99105,99109,99111,99113-99115,99118,99121-99123,99125-99126,99131,99133,99135,99144,99152,99155-99158,99160-99164,99167-99175,99177,99179-99180,99182-99183,99185-99188,99196-99197,99200,99203-99211,99216-99225,99227,99230,99232,99234-99236,99238,99244,99247,99250-99257,99261-99262,99264-99265,99268-99269,99272-99275,99277,99279,99281-99282,99284,99287-99291,99296,99300-99306,99309,99314-99317,99319,99322,99324-99326,99329-99332,99334,99336-99337,99341,99343-99352,99355-99360,99362-99363,99365-99366,99370,99373,99375-99384,99386,99388,99391,99393-99395,99398-99399,99405-99408,99410-99411,99413,99415,99419,99421-99422,99424-99425,99429,99431-99433,99435,99441-99444,99446-99464,99466-99467,99470-99478,99483,99485,99487,99492-99493,99495-99499,99503,99505-99506,99508-99510,99513-99514,99516-99521,99523-99529,99535-99541,99544-99548,99553,99556,99558-99560,99563,99566,99568-99570,99573-99574,99577-99586,99588,99591-99592,99596-99597,99602,99604-99610,99613,99615,99617,99619,99621,99623,99625-99627,99631-99633,99635-99637,99640,99642-99643,99646-99648,99650,99652,99654-99660,99662-99664,99666,99668-99670,99672-99676,99679-99680,99684,99687,99691-99705,99708,99710-99711,99714-99716,99719-99724,99726,99728-99729,99731-99733,99735-99742,99745-99750,99755,99757,99759-99760,99765,99767,99769,99773-99775,99777-99779,99782-99783,99785,99787,99789,99791-99792,99794,99796,99799-99801,99803,99806,99810-99817,99823-99835,99837-99840,99842-99844,99846-99862,99871,99877-99882,99884-99885,99889-99890,99892-99893,99896-99897,99899-99901,99903-99904,99906,99908,99910,99916,99919-99920,99922-99928,99930,99933,99935-99936,99939,99941-99946,99948-99953,99957,99960,99966-99967,99971-99972,99974,99976-99978,99981-99982,99984,99986,99988,99993,99996-99997,99999 via svnmerge from
svn+ssh://gcc.gnu.org/svn/gcc/trunk
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/reload-branch@109594 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/alpha/sync.md')
-rw-r--r-- | gcc/config/alpha/sync.md | 312 |
1 files changed, 312 insertions, 0 deletions
diff --git a/gcc/config/alpha/sync.md b/gcc/config/alpha/sync.md new file mode 100644 index 00000000000..8f67a4e255d --- /dev/null +++ b/gcc/config/alpha/sync.md @@ -0,0 +1,312 @@ +;; GCC machine description for Alpha synchronization instructions. +;; Copyright (C) 2005 +;; Free Software Foundation, Inc. +;; +;; This file is part of GCC. +;; +;; GCC is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; GCC is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GCC; see the file COPYING. If not, write to +;; the Free Software Foundation, 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +(define_mode_macro I48MODE [SI DI]) +(define_mode_attr modesuffix [(SI "l") (DI "q")]) + +(define_code_macro FETCHOP [plus minus ior xor and]) +(define_code_attr fetchop_name + [(plus "add") (minus "sub") (ior "ior") (xor "xor") (and "and")]) +(define_code_attr fetchop_pred + [(plus "add_operand") (minus "reg_or_8bit_operand") + (ior "or_operand") (xor "or_operand") (and "and_operand")]) +(define_code_attr fetchop_constr + [(plus "rKL") (minus "rI") (ior "rIN") (xor "rIN") (and "riNHM")]) + + +(define_expand "memory_barrier" + [(set (mem:BLK (match_dup 0)) + (unspec_volatile:BLK [(mem:BLK (match_dup 0))] UNSPECV_MB))] + "" +{ + operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode)); + MEM_VOLATILE_P (operands[0]) = 1; +}) + +(define_insn "*mb_internal" + [(set (match_operand:BLK 0 "" "") + (unspec_volatile:BLK [(match_operand:BLK 1 "" "")] UNSPECV_MB))] + "" + "mb" + [(set_attr "type" "mb")]) + +(define_insn "load_locked_<mode>" + [(set (match_operand:I48MODE 0 "register_operand" "=r") + (unspec_volatile:I48MODE + [(match_operand:I48MODE 1 "memory_operand" "m")] + UNSPECV_LL))] + "" + "ld<modesuffix>_l %0,%1" + [(set_attr "type" "ld_l")]) + +(define_insn "store_conditional_<mode>" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec_volatile:DI [(const_int 0)] UNSPECV_SC)) + (set (match_operand:I48MODE 1 "memory_operand" "=m") + (match_operand:I48MODE 2 "reg_or_0_operand" "0"))] + "" + "st<modesuffix>_c %0,%1" + [(set_attr "type" "st_c")]) + +;; The Alpha Architecture Handbook says that it is UNPREDICTABLE whether +;; the lock is cleared by a TAKEN branch. If we were to honor that, it +;; would mean that we could not expand a ll/sc sequence until after the +;; final basic-block reordering pass. Fortunately, it appears that no +;; Alpha implementation ever built actually clears the lock on branches, +;; taken or not. + +(define_insn_and_split "sync_<fetchop_name><mode>" + [(set (match_operand:I48MODE 0 "memory_operand" "+m") + (unspec_volatile:I48MODE + [(FETCHOP:I48MODE (match_dup 0) + (match_operand:I48MODE 1 "<fetchop_pred>" "<fetchop_constr>"))] + UNSPECV_ATOMIC)) + (clobber (match_scratch:I48MODE 2 "=&r"))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + alpha_split_atomic_op (<CODE>, operands[0], operands[1], + NULL, NULL, operands[2]); + DONE; +} + [(set_attr "type" "multi")]) + +(define_insn_and_split "sync_nand<mode>" + [(set (match_operand:I48MODE 0 "memory_operand" "+m") + (unspec_volatile:I48MODE + [(and:I48MODE (not:I48MODE (match_dup 0)) + (match_operand:I48MODE 1 "register_operand" "r"))] + UNSPECV_ATOMIC)) + (clobber (match_scratch:I48MODE 2 "=&r"))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + alpha_split_atomic_op (NOT, operands[0], operands[1], + NULL, NULL, operands[2]); + DONE; +} + [(set_attr "type" "multi")]) + +(define_insn_and_split "sync_old_<fetchop_name><mode>" + [(set (match_operand:I48MODE 0 "register_operand" "=&r") + (match_operand:I48MODE 1 "memory_operand" "+m")) + (set (match_dup 1) + (unspec_volatile:I48MODE + [(FETCHOP:I48MODE (match_dup 1) + (match_operand:I48MODE 2 "<fetchop_pred>" "<fetchop_constr>"))] + UNSPECV_ATOMIC)) + (clobber (match_scratch:I48MODE 3 "=&r"))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + alpha_split_atomic_op (<CODE>, operands[1], operands[2], + operands[0], NULL, operands[3]); + DONE; +} + [(set_attr "type" "multi")]) + +(define_insn_and_split "sync_old_nand<mode>" + [(set (match_operand:I48MODE 0 "register_operand" "=&r") + (match_operand:I48MODE 1 "memory_operand" "+m")) + (set (match_dup 1) + (unspec_volatile:I48MODE + [(and:I48MODE (not:I48MODE (match_dup 1)) + (match_operand:I48MODE 2 "register_operand" "r"))] + UNSPECV_ATOMIC)) + (clobber (match_scratch:I48MODE 3 "=&r"))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + alpha_split_atomic_op (NOT, operands[1], operands[2], + operands[0], NULL, operands[3]); + DONE; +} + [(set_attr "type" "multi")]) + +(define_insn_and_split "sync_new_<fetchop_name><mode>" + [(set (match_operand:I48MODE 0 "register_operand" "=&r") + (FETCHOP:I48MODE + (match_operand:I48MODE 1 "memory_operand" "+m") + (match_operand:I48MODE 2 "<fetchop_pred>" "<fetchop_constr>"))) + (set (match_dup 1) + (unspec_volatile:I48MODE + [(FETCHOP:I48MODE (match_dup 1) (match_dup 2))] + UNSPECV_ATOMIC)) + (clobber (match_scratch:I48MODE 3 "=&r"))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + alpha_split_atomic_op (<CODE>, operands[1], operands[2], + NULL, operands[0], operands[3]); + DONE; +} + [(set_attr "type" "multi")]) + +(define_insn_and_split "sync_new_nand<mode>" + [(set (match_operand:I48MODE 0 "register_operand" "=&r") + (and:I48MODE + (not:I48MODE (match_operand:I48MODE 1 "memory_operand" "+m")) + (match_operand:I48MODE 2 "register_operand" "r"))) + (set (match_dup 1) + (unspec_volatile:I48MODE + [(and:I48MODE (not:I48MODE (match_dup 1)) (match_dup 2))] + UNSPECV_ATOMIC)) + (clobber (match_scratch:I48MODE 3 "=&r"))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + alpha_split_atomic_op (NOT, operands[1], operands[2], + NULL, operands[0], operands[3]); + DONE; +} + [(set_attr "type" "multi")]) + +(define_expand "sync_compare_and_swap<mode>" + [(parallel + [(set (match_operand:I48MODE 0 "register_operand" "") + (match_operand:I48MODE 1 "memory_operand" "")) + (set (match_dup 1) + (unspec_volatile:I48MODE + [(match_operand:I48MODE 2 "reg_or_8bit_operand" "") + (match_operand:I48MODE 3 "add_operand" "rKL")] + UNSPECV_CMPXCHG)) + (clobber (match_scratch:I48MODE 4 "=&r"))])] + "" +{ + if (<MODE>mode == SImode) + operands[2] = convert_modes (DImode, SImode, operands[2], 0); +}) + +(define_insn_and_split "*sync_compare_and_swap<mode>" + [(set (match_operand:I48MODE 0 "register_operand" "=&r") + (match_operand:I48MODE 1 "memory_operand" "+m")) + (set (match_dup 1) + (unspec_volatile:I48MODE + [(match_operand:DI 2 "reg_or_8bit_operand" "rI") + (match_operand:I48MODE 3 "add_operand" "rKL")] + UNSPECV_CMPXCHG)) + (clobber (match_scratch:I48MODE 4 "=&r"))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + rtx retval, mem, oldval, newval, scratch; + rtx cond, label1, label2, x; + rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1); + + retval = operands[0]; + mem = operands[1]; + oldval = operands[2]; + newval = operands[3]; + scratch = operands[4]; + cond = gen_lowpart (DImode, scratch); + + emit_insn (gen_memory_barrier ()); + + label1 = gen_rtx_LABEL_REF (DImode, gen_label_rtx ()); + label2 = gen_rtx_LABEL_REF (DImode, gen_label_rtx ()); + emit_label (XEXP (label1, 0)); + + emit_insn (gen_load_locked_<mode> (retval, mem)); + + x = gen_lowpart (DImode, retval); + if (oldval == const0_rtx) + x = gen_rtx_NE (DImode, x, const0_rtx); + else + { + x = gen_rtx_EQ (DImode, x, oldval); + emit_insn (gen_rtx_SET (VOIDmode, cond, x)); + x = gen_rtx_EQ (DImode, cond, const0_rtx); + } + x = gen_rtx_IF_THEN_ELSE (VOIDmode, x, label2, pc_rtx); + x = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, x)); + REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_BR_PROB, very_unlikely, NULL_RTX); + + emit_move_insn (scratch, newval); + + emit_insn (gen_store_conditional_<mode> (cond, mem, scratch)); + + x = gen_rtx_EQ (DImode, cond, const0_rtx); + x = gen_rtx_IF_THEN_ELSE (VOIDmode, x, label1, pc_rtx); + x = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, x)); + REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_BR_PROB, very_unlikely, NULL_RTX); + + emit_insn (gen_memory_barrier ()); + emit_label (XEXP (label2, 0)); + DONE; +} + [(set_attr "type" "multi")]) + +(define_insn_and_split "sync_lock_test_and_set<mode>" + [(set (match_operand:I48MODE 0 "register_operand" "=&r") + (match_operand:I48MODE 1 "memory_operand" "+m")) + (set (match_dup 1) + (unspec_volatile:I48MODE + [(match_operand:I48MODE 2 "add_operand" "rKL")] + UNSPECV_XCHG)) + (clobber (match_scratch:I48MODE 3 "=&r"))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + rtx retval, mem, val, scratch; + rtx cond, label1, x; + rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1); + + retval = operands[0]; + mem = operands[1]; + val = operands[2]; + scratch = operands[3]; + cond = gen_lowpart (DImode, scratch); + + emit_insn (gen_memory_barrier ()); + + label1 = gen_rtx_LABEL_REF (DImode, gen_label_rtx ()); + emit_label (XEXP (label1, 0)); + + emit_insn (gen_load_locked_<mode> (retval, mem)); + + emit_move_insn (scratch, val); + + emit_insn (gen_store_conditional_<mode> (cond, mem, scratch)); + + x = gen_rtx_EQ (DImode, cond, const0_rtx); + x = gen_rtx_IF_THEN_ELSE (VOIDmode, x, label1, pc_rtx); + x = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, x)); + REG_NOTES (x) = gen_rtx_EXPR_LIST (REG_BR_PROB, very_unlikely, NULL_RTX); + + DONE; +} + [(set_attr "type" "multi")]) |