altivec.h 593 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736
  1. /*===---- altivec.h - Standard header for type generic math ---------------===*\
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. * THE SOFTWARE.
  20. *
  21. \*===----------------------------------------------------------------------===*/
  22. #ifndef __ALTIVEC_H
  23. #define __ALTIVEC_H
  24. #ifndef __ALTIVEC__
  25. #error "AltiVec support not enabled"
  26. #endif
  27. /* Constants for mapping CR6 bits to predicate result. */
  28. #define __CR6_EQ 0
  29. #define __CR6_EQ_REV 1
  30. #define __CR6_LT 2
  31. #define __CR6_LT_REV 3
  32. /* Constants for vec_test_data_class */
  33. #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0)
  34. #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1)
  35. #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \
  36. __VEC_CLASS_FP_SUBNORMAL_N)
  37. #define __VEC_CLASS_FP_ZERO_N (1<<2)
  38. #define __VEC_CLASS_FP_ZERO_P (1<<3)
  39. #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \
  40. __VEC_CLASS_FP_ZERO_N)
  41. #define __VEC_CLASS_FP_INFINITY_N (1<<4)
  42. #define __VEC_CLASS_FP_INFINITY_P (1<<5)
  43. #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \
  44. __VEC_CLASS_FP_INFINITY_N)
  45. #define __VEC_CLASS_FP_NAN (1<<6)
  46. #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \
  47. __VEC_CLASS_FP_SUBNORMAL | \
  48. __VEC_CLASS_FP_ZERO | \
  49. __VEC_CLASS_FP_INFINITY)
  50. #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
  51. #ifdef __POWER9_VECTOR__
  52. #include <stddef.h>
  53. #endif
  54. static __inline__ vector signed char __ATTRS_o_ai vec_perm(
  55. vector signed char __a, vector signed char __b, vector unsigned char __c);
  56. static __inline__ vector unsigned char __ATTRS_o_ai
  57. vec_perm(vector unsigned char __a, vector unsigned char __b,
  58. vector unsigned char __c);
  59. static __inline__ vector bool char __ATTRS_o_ai
  60. vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
  61. static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
  62. vector signed short __b,
  63. vector unsigned char __c);
  64. static __inline__ vector unsigned short __ATTRS_o_ai
  65. vec_perm(vector unsigned short __a, vector unsigned short __b,
  66. vector unsigned char __c);
  67. static __inline__ vector bool short __ATTRS_o_ai vec_perm(
  68. vector bool short __a, vector bool short __b, vector unsigned char __c);
  69. static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
  70. vector pixel __b,
  71. vector unsigned char __c);
  72. static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
  73. vector signed int __b,
  74. vector unsigned char __c);
  75. static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
  76. vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
  77. static __inline__ vector bool int __ATTRS_o_ai
  78. vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
  79. static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
  80. vector float __b,
  81. vector unsigned char __c);
  82. #ifdef __VSX__
  83. static __inline__ vector long long __ATTRS_o_ai
  84. vec_perm(vector signed long long __a, vector signed long long __b,
  85. vector unsigned char __c);
  86. static __inline__ vector unsigned long long __ATTRS_o_ai
  87. vec_perm(vector unsigned long long __a, vector unsigned long long __b,
  88. vector unsigned char __c);
  89. static __inline__ vector bool long long __ATTRS_o_ai
  90. vec_perm(vector bool long long __a, vector bool long long __b,
  91. vector unsigned char __c);
  92. static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
  93. vector double __b,
  94. vector unsigned char __c);
  95. #endif
  96. static __inline__ vector unsigned char __ATTRS_o_ai
  97. vec_xor(vector unsigned char __a, vector unsigned char __b);
  98. /* vec_abs */
  99. #define __builtin_altivec_abs_v16qi vec_abs
  100. #define __builtin_altivec_abs_v8hi vec_abs
  101. #define __builtin_altivec_abs_v4si vec_abs
  102. static __inline__ vector signed char __ATTRS_o_ai
  103. vec_abs(vector signed char __a) {
  104. return __builtin_altivec_vmaxsb(__a, -__a);
  105. }
  106. static __inline__ vector signed short __ATTRS_o_ai
  107. vec_abs(vector signed short __a) {
  108. return __builtin_altivec_vmaxsh(__a, -__a);
  109. }
  110. static __inline__ vector signed int __ATTRS_o_ai
  111. vec_abs(vector signed int __a) {
  112. return __builtin_altivec_vmaxsw(__a, -__a);
  113. }
  114. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  115. static __inline__ vector signed long long __ATTRS_o_ai
  116. vec_abs(vector signed long long __a) {
  117. return __builtin_altivec_vmaxsd(__a, -__a);
  118. }
  119. #endif
  120. static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
  121. #ifdef __VSX__
  122. return __builtin_vsx_xvabssp(__a);
  123. #else
  124. vector unsigned int __res =
  125. (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
  126. return (vector float)__res;
  127. #endif
  128. }
  129. #ifdef __VSX__
  130. static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
  131. return __builtin_vsx_xvabsdp(__a);
  132. }
  133. #endif
  134. /* vec_abss */
  135. #define __builtin_altivec_abss_v16qi vec_abss
  136. #define __builtin_altivec_abss_v8hi vec_abss
  137. #define __builtin_altivec_abss_v4si vec_abss
  138. static __inline__ vector signed char __ATTRS_o_ai
  139. vec_abss(vector signed char __a) {
  140. return __builtin_altivec_vmaxsb(
  141. __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
  142. }
  143. static __inline__ vector signed short __ATTRS_o_ai
  144. vec_abss(vector signed short __a) {
  145. return __builtin_altivec_vmaxsh(
  146. __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
  147. }
  148. static __inline__ vector signed int __ATTRS_o_ai
  149. vec_abss(vector signed int __a) {
  150. return __builtin_altivec_vmaxsw(
  151. __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
  152. }
  153. /* vec_absd */
  154. #if defined(__POWER9_VECTOR__)
  155. static __inline__ vector unsigned char __ATTRS_o_ai
  156. vec_absd(vector unsigned char __a, vector unsigned char __b) {
  157. return __builtin_altivec_vabsdub(__a, __b);
  158. }
  159. static __inline__ vector unsigned short __ATTRS_o_ai
  160. vec_absd(vector unsigned short __a, vector unsigned short __b) {
  161. return __builtin_altivec_vabsduh(__a, __b);
  162. }
  163. static __inline__ vector unsigned int __ATTRS_o_ai
  164. vec_absd(vector unsigned int __a, vector unsigned int __b) {
  165. return __builtin_altivec_vabsduw(__a, __b);
  166. }
  167. #endif /* End __POWER9_VECTOR__ */
  168. /* vec_add */
  169. static __inline__ vector signed char __ATTRS_o_ai
  170. vec_add(vector signed char __a, vector signed char __b) {
  171. return __a + __b;
  172. }
  173. static __inline__ vector signed char __ATTRS_o_ai
  174. vec_add(vector bool char __a, vector signed char __b) {
  175. return (vector signed char)__a + __b;
  176. }
  177. static __inline__ vector signed char __ATTRS_o_ai
  178. vec_add(vector signed char __a, vector bool char __b) {
  179. return __a + (vector signed char)__b;
  180. }
  181. static __inline__ vector unsigned char __ATTRS_o_ai
  182. vec_add(vector unsigned char __a, vector unsigned char __b) {
  183. return __a + __b;
  184. }
  185. static __inline__ vector unsigned char __ATTRS_o_ai
  186. vec_add(vector bool char __a, vector unsigned char __b) {
  187. return (vector unsigned char)__a + __b;
  188. }
  189. static __inline__ vector unsigned char __ATTRS_o_ai
  190. vec_add(vector unsigned char __a, vector bool char __b) {
  191. return __a + (vector unsigned char)__b;
  192. }
  193. static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
  194. vector short __b) {
  195. return __a + __b;
  196. }
  197. static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
  198. vector short __b) {
  199. return (vector short)__a + __b;
  200. }
  201. static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
  202. vector bool short __b) {
  203. return __a + (vector short)__b;
  204. }
  205. static __inline__ vector unsigned short __ATTRS_o_ai
  206. vec_add(vector unsigned short __a, vector unsigned short __b) {
  207. return __a + __b;
  208. }
  209. static __inline__ vector unsigned short __ATTRS_o_ai
  210. vec_add(vector bool short __a, vector unsigned short __b) {
  211. return (vector unsigned short)__a + __b;
  212. }
  213. static __inline__ vector unsigned short __ATTRS_o_ai
  214. vec_add(vector unsigned short __a, vector bool short __b) {
  215. return __a + (vector unsigned short)__b;
  216. }
  217. static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
  218. vector int __b) {
  219. return __a + __b;
  220. }
  221. static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
  222. vector int __b) {
  223. return (vector int)__a + __b;
  224. }
  225. static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
  226. vector bool int __b) {
  227. return __a + (vector int)__b;
  228. }
  229. static __inline__ vector unsigned int __ATTRS_o_ai
  230. vec_add(vector unsigned int __a, vector unsigned int __b) {
  231. return __a + __b;
  232. }
  233. static __inline__ vector unsigned int __ATTRS_o_ai
  234. vec_add(vector bool int __a, vector unsigned int __b) {
  235. return (vector unsigned int)__a + __b;
  236. }
  237. static __inline__ vector unsigned int __ATTRS_o_ai
  238. vec_add(vector unsigned int __a, vector bool int __b) {
  239. return __a + (vector unsigned int)__b;
  240. }
  241. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  242. static __inline__ vector signed long long __ATTRS_o_ai
  243. vec_add(vector signed long long __a, vector signed long long __b) {
  244. return __a + __b;
  245. }
  246. static __inline__ vector unsigned long long __ATTRS_o_ai
  247. vec_add(vector unsigned long long __a, vector unsigned long long __b) {
  248. return __a + __b;
  249. }
  250. static __inline__ vector signed __int128 __ATTRS_o_ai
  251. vec_add(vector signed __int128 __a, vector signed __int128 __b) {
  252. return __a + __b;
  253. }
  254. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  255. vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
  256. return __a + __b;
  257. }
  258. #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  259. static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
  260. vector float __b) {
  261. return __a + __b;
  262. }
  263. #ifdef __VSX__
  264. static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
  265. vector double __b) {
  266. return __a + __b;
  267. }
  268. #endif // __VSX__
  269. /* vec_adde */
  270. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  271. static __inline__ vector signed __int128 __ATTRS_o_ai
  272. vec_adde(vector signed __int128 __a, vector signed __int128 __b,
  273. vector signed __int128 __c) {
  274. return __builtin_altivec_vaddeuqm(__a, __b, __c);
  275. }
  276. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  277. vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
  278. vector unsigned __int128 __c) {
  279. return __builtin_altivec_vaddeuqm(__a, __b, __c);
  280. }
  281. #endif
  282. static __inline__ vector signed int __ATTRS_o_ai
  283. vec_adde(vector signed int __a, vector signed int __b,
  284. vector signed int __c) {
  285. vector signed int __mask = {1, 1, 1, 1};
  286. vector signed int __carry = __c & __mask;
  287. return vec_add(vec_add(__a, __b), __carry);
  288. }
  289. static __inline__ vector unsigned int __ATTRS_o_ai
  290. vec_adde(vector unsigned int __a, vector unsigned int __b,
  291. vector unsigned int __c) {
  292. vector unsigned int __mask = {1, 1, 1, 1};
  293. vector unsigned int __carry = __c & __mask;
  294. return vec_add(vec_add(__a, __b), __carry);
  295. }
  296. /* vec_addec */
  297. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  298. static __inline__ vector signed __int128 __ATTRS_o_ai
  299. vec_addec(vector signed __int128 __a, vector signed __int128 __b,
  300. vector signed __int128 __c) {
  301. return __builtin_altivec_vaddecuq(__a, __b, __c);
  302. }
  303. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  304. vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
  305. vector unsigned __int128 __c) {
  306. return __builtin_altivec_vaddecuq(__a, __b, __c);
  307. }
  308. static __inline__ vector signed int __ATTRS_o_ai
  309. vec_addec(vector signed int __a, vector signed int __b,
  310. vector signed int __c) {
  311. signed int __result[4];
  312. for (int i = 0; i < 4; i++) {
  313. unsigned int __tempa = (unsigned int) __a[i];
  314. unsigned int __tempb = (unsigned int) __b[i];
  315. unsigned int __tempc = (unsigned int) __c[i];
  316. __tempc = __tempc & 0x00000001;
  317. unsigned long long __longa = (unsigned long long) __tempa;
  318. unsigned long long __longb = (unsigned long long) __tempb;
  319. unsigned long long __longc = (unsigned long long) __tempc;
  320. unsigned long long __sum = __longa + __longb + __longc;
  321. unsigned long long __res = (__sum >> 32) & 0x01;
  322. unsigned long long __tempres = (unsigned int) __res;
  323. __result[i] = (signed int) __tempres;
  324. }
  325. vector signed int ret = { __result[0], __result[1], __result[2], __result[3] };
  326. return ret;
  327. }
  328. static __inline__ vector unsigned int __ATTRS_o_ai
  329. vec_addec(vector unsigned int __a, vector unsigned int __b,
  330. vector unsigned int __c) {
  331. unsigned int __result[4];
  332. for (int i = 0; i < 4; i++) {
  333. unsigned int __tempc = __c[i] & 1;
  334. unsigned long long __longa = (unsigned long long) __a[i];
  335. unsigned long long __longb = (unsigned long long) __b[i];
  336. unsigned long long __longc = (unsigned long long) __tempc;
  337. unsigned long long __sum = __longa + __longb + __longc;
  338. unsigned long long __res = (__sum >> 32) & 0x01;
  339. unsigned long long __tempres = (unsigned int) __res;
  340. __result[i] = (signed int) __tempres;
  341. }
  342. vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
  343. return ret;
  344. }
  345. #endif
  346. /* vec_vaddubm */
  347. #define __builtin_altivec_vaddubm vec_vaddubm
  348. static __inline__ vector signed char __ATTRS_o_ai
  349. vec_vaddubm(vector signed char __a, vector signed char __b) {
  350. return __a + __b;
  351. }
  352. static __inline__ vector signed char __ATTRS_o_ai
  353. vec_vaddubm(vector bool char __a, vector signed char __b) {
  354. return (vector signed char)__a + __b;
  355. }
  356. static __inline__ vector signed char __ATTRS_o_ai
  357. vec_vaddubm(vector signed char __a, vector bool char __b) {
  358. return __a + (vector signed char)__b;
  359. }
  360. static __inline__ vector unsigned char __ATTRS_o_ai
  361. vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
  362. return __a + __b;
  363. }
  364. static __inline__ vector unsigned char __ATTRS_o_ai
  365. vec_vaddubm(vector bool char __a, vector unsigned char __b) {
  366. return (vector unsigned char)__a + __b;
  367. }
  368. static __inline__ vector unsigned char __ATTRS_o_ai
  369. vec_vaddubm(vector unsigned char __a, vector bool char __b) {
  370. return __a + (vector unsigned char)__b;
  371. }
  372. /* vec_vadduhm */
  373. #define __builtin_altivec_vadduhm vec_vadduhm
  374. static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
  375. vector short __b) {
  376. return __a + __b;
  377. }
  378. static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
  379. vector short __b) {
  380. return (vector short)__a + __b;
  381. }
  382. static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
  383. vector bool short __b) {
  384. return __a + (vector short)__b;
  385. }
  386. static __inline__ vector unsigned short __ATTRS_o_ai
  387. vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
  388. return __a + __b;
  389. }
  390. static __inline__ vector unsigned short __ATTRS_o_ai
  391. vec_vadduhm(vector bool short __a, vector unsigned short __b) {
  392. return (vector unsigned short)__a + __b;
  393. }
  394. static __inline__ vector unsigned short __ATTRS_o_ai
  395. vec_vadduhm(vector unsigned short __a, vector bool short __b) {
  396. return __a + (vector unsigned short)__b;
  397. }
  398. /* vec_vadduwm */
  399. #define __builtin_altivec_vadduwm vec_vadduwm
  400. static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
  401. vector int __b) {
  402. return __a + __b;
  403. }
  404. static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
  405. vector int __b) {
  406. return (vector int)__a + __b;
  407. }
  408. static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
  409. vector bool int __b) {
  410. return __a + (vector int)__b;
  411. }
  412. static __inline__ vector unsigned int __ATTRS_o_ai
  413. vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
  414. return __a + __b;
  415. }
  416. static __inline__ vector unsigned int __ATTRS_o_ai
  417. vec_vadduwm(vector bool int __a, vector unsigned int __b) {
  418. return (vector unsigned int)__a + __b;
  419. }
  420. static __inline__ vector unsigned int __ATTRS_o_ai
  421. vec_vadduwm(vector unsigned int __a, vector bool int __b) {
  422. return __a + (vector unsigned int)__b;
  423. }
  424. /* vec_vaddfp */
  425. #define __builtin_altivec_vaddfp vec_vaddfp
  426. static __inline__ vector float __attribute__((__always_inline__))
  427. vec_vaddfp(vector float __a, vector float __b) {
  428. return __a + __b;
  429. }
  430. /* vec_addc */
  431. static __inline__ vector signed int __ATTRS_o_ai
  432. vec_addc(vector signed int __a, vector signed int __b) {
  433. return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
  434. (vector unsigned int)__b);
  435. }
  436. static __inline__ vector unsigned int __ATTRS_o_ai
  437. vec_addc(vector unsigned int __a, vector unsigned int __b) {
  438. return __builtin_altivec_vaddcuw(__a, __b);
  439. }
  440. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  441. static __inline__ vector signed __int128 __ATTRS_o_ai
  442. vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
  443. return (vector signed __int128)__builtin_altivec_vaddcuq(
  444. (vector unsigned __int128)__a, (vector unsigned __int128)__b);
  445. }
  446. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  447. vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
  448. return __builtin_altivec_vaddcuq(__a, __b);
  449. }
  450. #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  451. /* vec_vaddcuw */
  452. static __inline__ vector unsigned int __attribute__((__always_inline__))
  453. vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
  454. return __builtin_altivec_vaddcuw(__a, __b);
  455. }
  456. /* vec_adds */
  457. static __inline__ vector signed char __ATTRS_o_ai
  458. vec_adds(vector signed char __a, vector signed char __b) {
  459. return __builtin_altivec_vaddsbs(__a, __b);
  460. }
  461. static __inline__ vector signed char __ATTRS_o_ai
  462. vec_adds(vector bool char __a, vector signed char __b) {
  463. return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
  464. }
  465. static __inline__ vector signed char __ATTRS_o_ai
  466. vec_adds(vector signed char __a, vector bool char __b) {
  467. return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
  468. }
  469. static __inline__ vector unsigned char __ATTRS_o_ai
  470. vec_adds(vector unsigned char __a, vector unsigned char __b) {
  471. return __builtin_altivec_vaddubs(__a, __b);
  472. }
  473. static __inline__ vector unsigned char __ATTRS_o_ai
  474. vec_adds(vector bool char __a, vector unsigned char __b) {
  475. return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
  476. }
  477. static __inline__ vector unsigned char __ATTRS_o_ai
  478. vec_adds(vector unsigned char __a, vector bool char __b) {
  479. return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
  480. }
  481. static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
  482. vector short __b) {
  483. return __builtin_altivec_vaddshs(__a, __b);
  484. }
  485. static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
  486. vector short __b) {
  487. return __builtin_altivec_vaddshs((vector short)__a, __b);
  488. }
  489. static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
  490. vector bool short __b) {
  491. return __builtin_altivec_vaddshs(__a, (vector short)__b);
  492. }
  493. static __inline__ vector unsigned short __ATTRS_o_ai
  494. vec_adds(vector unsigned short __a, vector unsigned short __b) {
  495. return __builtin_altivec_vadduhs(__a, __b);
  496. }
  497. static __inline__ vector unsigned short __ATTRS_o_ai
  498. vec_adds(vector bool short __a, vector unsigned short __b) {
  499. return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
  500. }
  501. static __inline__ vector unsigned short __ATTRS_o_ai
  502. vec_adds(vector unsigned short __a, vector bool short __b) {
  503. return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
  504. }
  505. static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
  506. vector int __b) {
  507. return __builtin_altivec_vaddsws(__a, __b);
  508. }
  509. static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
  510. vector int __b) {
  511. return __builtin_altivec_vaddsws((vector int)__a, __b);
  512. }
  513. static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
  514. vector bool int __b) {
  515. return __builtin_altivec_vaddsws(__a, (vector int)__b);
  516. }
  517. static __inline__ vector unsigned int __ATTRS_o_ai
  518. vec_adds(vector unsigned int __a, vector unsigned int __b) {
  519. return __builtin_altivec_vadduws(__a, __b);
  520. }
  521. static __inline__ vector unsigned int __ATTRS_o_ai
  522. vec_adds(vector bool int __a, vector unsigned int __b) {
  523. return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
  524. }
  525. static __inline__ vector unsigned int __ATTRS_o_ai
  526. vec_adds(vector unsigned int __a, vector bool int __b) {
  527. return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
  528. }
  529. /* vec_vaddsbs */
  530. static __inline__ vector signed char __ATTRS_o_ai
  531. vec_vaddsbs(vector signed char __a, vector signed char __b) {
  532. return __builtin_altivec_vaddsbs(__a, __b);
  533. }
  534. static __inline__ vector signed char __ATTRS_o_ai
  535. vec_vaddsbs(vector bool char __a, vector signed char __b) {
  536. return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
  537. }
  538. static __inline__ vector signed char __ATTRS_o_ai
  539. vec_vaddsbs(vector signed char __a, vector bool char __b) {
  540. return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
  541. }
  542. /* vec_vaddubs */
  543. static __inline__ vector unsigned char __ATTRS_o_ai
  544. vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
  545. return __builtin_altivec_vaddubs(__a, __b);
  546. }
  547. static __inline__ vector unsigned char __ATTRS_o_ai
  548. vec_vaddubs(vector bool char __a, vector unsigned char __b) {
  549. return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
  550. }
  551. static __inline__ vector unsigned char __ATTRS_o_ai
  552. vec_vaddubs(vector unsigned char __a, vector bool char __b) {
  553. return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
  554. }
  555. /* vec_vaddshs */
  556. static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
  557. vector short __b) {
  558. return __builtin_altivec_vaddshs(__a, __b);
  559. }
  560. static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
  561. vector short __b) {
  562. return __builtin_altivec_vaddshs((vector short)__a, __b);
  563. }
  564. static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
  565. vector bool short __b) {
  566. return __builtin_altivec_vaddshs(__a, (vector short)__b);
  567. }
  568. /* vec_vadduhs */
  569. static __inline__ vector unsigned short __ATTRS_o_ai
  570. vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
  571. return __builtin_altivec_vadduhs(__a, __b);
  572. }
  573. static __inline__ vector unsigned short __ATTRS_o_ai
  574. vec_vadduhs(vector bool short __a, vector unsigned short __b) {
  575. return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
  576. }
  577. static __inline__ vector unsigned short __ATTRS_o_ai
  578. vec_vadduhs(vector unsigned short __a, vector bool short __b) {
  579. return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
  580. }
  581. /* vec_vaddsws */
  582. static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
  583. vector int __b) {
  584. return __builtin_altivec_vaddsws(__a, __b);
  585. }
  586. static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
  587. vector int __b) {
  588. return __builtin_altivec_vaddsws((vector int)__a, __b);
  589. }
  590. static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
  591. vector bool int __b) {
  592. return __builtin_altivec_vaddsws(__a, (vector int)__b);
  593. }
  594. /* vec_vadduws */
  595. static __inline__ vector unsigned int __ATTRS_o_ai
  596. vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
  597. return __builtin_altivec_vadduws(__a, __b);
  598. }
  599. static __inline__ vector unsigned int __ATTRS_o_ai
  600. vec_vadduws(vector bool int __a, vector unsigned int __b) {
  601. return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
  602. }
  603. static __inline__ vector unsigned int __ATTRS_o_ai
  604. vec_vadduws(vector unsigned int __a, vector bool int __b) {
  605. return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
  606. }
  607. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  608. /* vec_vadduqm */
  609. static __inline__ vector signed __int128 __ATTRS_o_ai
  610. vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
  611. return __a + __b;
  612. }
  613. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  614. vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
  615. return __a + __b;
  616. }
  617. /* vec_vaddeuqm */
  618. static __inline__ vector signed __int128 __ATTRS_o_ai
  619. vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
  620. vector signed __int128 __c) {
  621. return __builtin_altivec_vaddeuqm(__a, __b, __c);
  622. }
  623. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  624. vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
  625. vector unsigned __int128 __c) {
  626. return __builtin_altivec_vaddeuqm(__a, __b, __c);
  627. }
  628. /* vec_vaddcuq */
  629. static __inline__ vector signed __int128 __ATTRS_o_ai
  630. vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
  631. return __builtin_altivec_vaddcuq(__a, __b);
  632. }
  633. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  634. vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
  635. return __builtin_altivec_vaddcuq(__a, __b);
  636. }
  637. /* vec_vaddecuq */
  638. static __inline__ vector signed __int128 __ATTRS_o_ai
  639. vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
  640. vector signed __int128 __c) {
  641. return __builtin_altivec_vaddecuq(__a, __b, __c);
  642. }
  643. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  644. vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
  645. vector unsigned __int128 __c) {
  646. return __builtin_altivec_vaddecuq(__a, __b, __c);
  647. }
  648. #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  649. /* vec_and */
  650. #define __builtin_altivec_vand vec_and
  651. static __inline__ vector signed char __ATTRS_o_ai
  652. vec_and(vector signed char __a, vector signed char __b) {
  653. return __a & __b;
  654. }
  655. static __inline__ vector signed char __ATTRS_o_ai
  656. vec_and(vector bool char __a, vector signed char __b) {
  657. return (vector signed char)__a & __b;
  658. }
  659. static __inline__ vector signed char __ATTRS_o_ai
  660. vec_and(vector signed char __a, vector bool char __b) {
  661. return __a & (vector signed char)__b;
  662. }
  663. static __inline__ vector unsigned char __ATTRS_o_ai
  664. vec_and(vector unsigned char __a, vector unsigned char __b) {
  665. return __a & __b;
  666. }
  667. static __inline__ vector unsigned char __ATTRS_o_ai
  668. vec_and(vector bool char __a, vector unsigned char __b) {
  669. return (vector unsigned char)__a & __b;
  670. }
  671. static __inline__ vector unsigned char __ATTRS_o_ai
  672. vec_and(vector unsigned char __a, vector bool char __b) {
  673. return __a & (vector unsigned char)__b;
  674. }
  675. static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
  676. vector bool char __b) {
  677. return __a & __b;
  678. }
  679. static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
  680. vector short __b) {
  681. return __a & __b;
  682. }
  683. static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
  684. vector short __b) {
  685. return (vector short)__a & __b;
  686. }
  687. static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
  688. vector bool short __b) {
  689. return __a & (vector short)__b;
  690. }
  691. static __inline__ vector unsigned short __ATTRS_o_ai
  692. vec_and(vector unsigned short __a, vector unsigned short __b) {
  693. return __a & __b;
  694. }
  695. static __inline__ vector unsigned short __ATTRS_o_ai
  696. vec_and(vector bool short __a, vector unsigned short __b) {
  697. return (vector unsigned short)__a & __b;
  698. }
  699. static __inline__ vector unsigned short __ATTRS_o_ai
  700. vec_and(vector unsigned short __a, vector bool short __b) {
  701. return __a & (vector unsigned short)__b;
  702. }
  703. static __inline__ vector bool short __ATTRS_o_ai
  704. vec_and(vector bool short __a, vector bool short __b) {
  705. return __a & __b;
  706. }
  707. static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
  708. vector int __b) {
  709. return __a & __b;
  710. }
  711. static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
  712. vector int __b) {
  713. return (vector int)__a & __b;
  714. }
  715. static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
  716. vector bool int __b) {
  717. return __a & (vector int)__b;
  718. }
  719. static __inline__ vector unsigned int __ATTRS_o_ai
  720. vec_and(vector unsigned int __a, vector unsigned int __b) {
  721. return __a & __b;
  722. }
  723. static __inline__ vector unsigned int __ATTRS_o_ai
  724. vec_and(vector bool int __a, vector unsigned int __b) {
  725. return (vector unsigned int)__a & __b;
  726. }
  727. static __inline__ vector unsigned int __ATTRS_o_ai
  728. vec_and(vector unsigned int __a, vector bool int __b) {
  729. return __a & (vector unsigned int)__b;
  730. }
  731. static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
  732. vector bool int __b) {
  733. return __a & __b;
  734. }
  735. static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
  736. vector float __b) {
  737. vector unsigned int __res =
  738. (vector unsigned int)__a & (vector unsigned int)__b;
  739. return (vector float)__res;
  740. }
  741. static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
  742. vector float __b) {
  743. vector unsigned int __res =
  744. (vector unsigned int)__a & (vector unsigned int)__b;
  745. return (vector float)__res;
  746. }
  747. static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
  748. vector bool int __b) {
  749. vector unsigned int __res =
  750. (vector unsigned int)__a & (vector unsigned int)__b;
  751. return (vector float)__res;
  752. }
  753. #ifdef __VSX__
  754. static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
  755. vector double __b) {
  756. vector unsigned long long __res =
  757. (vector unsigned long long)__a & (vector unsigned long long)__b;
  758. return (vector double)__res;
  759. }
  760. static __inline__ vector double __ATTRS_o_ai
  761. vec_and(vector double __a, vector bool long long __b) {
  762. vector unsigned long long __res =
  763. (vector unsigned long long)__a & (vector unsigned long long)__b;
  764. return (vector double)__res;
  765. }
  766. static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
  767. vector double __b) {
  768. vector unsigned long long __res =
  769. (vector unsigned long long)__a & (vector unsigned long long)__b;
  770. return (vector double)__res;
  771. }
  772. static __inline__ vector signed long long __ATTRS_o_ai
  773. vec_and(vector signed long long __a, vector signed long long __b) {
  774. return __a & __b;
  775. }
  776. static __inline__ vector signed long long __ATTRS_o_ai
  777. vec_and(vector bool long long __a, vector signed long long __b) {
  778. return (vector signed long long)__a & __b;
  779. }
  780. static __inline__ vector signed long long __ATTRS_o_ai
  781. vec_and(vector signed long long __a, vector bool long long __b) {
  782. return __a & (vector signed long long)__b;
  783. }
  784. static __inline__ vector unsigned long long __ATTRS_o_ai
  785. vec_and(vector unsigned long long __a, vector unsigned long long __b) {
  786. return __a & __b;
  787. }
  788. static __inline__ vector unsigned long long __ATTRS_o_ai
  789. vec_and(vector bool long long __a, vector unsigned long long __b) {
  790. return (vector unsigned long long)__a & __b;
  791. }
  792. static __inline__ vector unsigned long long __ATTRS_o_ai
  793. vec_and(vector unsigned long long __a, vector bool long long __b) {
  794. return __a & (vector unsigned long long)__b;
  795. }
  796. static __inline__ vector bool long long __ATTRS_o_ai
  797. vec_and(vector bool long long __a, vector bool long long __b) {
  798. return __a & __b;
  799. }
  800. #endif
  801. /* vec_vand */
  802. static __inline__ vector signed char __ATTRS_o_ai
  803. vec_vand(vector signed char __a, vector signed char __b) {
  804. return __a & __b;
  805. }
  806. static __inline__ vector signed char __ATTRS_o_ai
  807. vec_vand(vector bool char __a, vector signed char __b) {
  808. return (vector signed char)__a & __b;
  809. }
  810. static __inline__ vector signed char __ATTRS_o_ai
  811. vec_vand(vector signed char __a, vector bool char __b) {
  812. return __a & (vector signed char)__b;
  813. }
  814. static __inline__ vector unsigned char __ATTRS_o_ai
  815. vec_vand(vector unsigned char __a, vector unsigned char __b) {
  816. return __a & __b;
  817. }
  818. static __inline__ vector unsigned char __ATTRS_o_ai
  819. vec_vand(vector bool char __a, vector unsigned char __b) {
  820. return (vector unsigned char)__a & __b;
  821. }
  822. static __inline__ vector unsigned char __ATTRS_o_ai
  823. vec_vand(vector unsigned char __a, vector bool char __b) {
  824. return __a & (vector unsigned char)__b;
  825. }
  826. static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
  827. vector bool char __b) {
  828. return __a & __b;
  829. }
  830. static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
  831. vector short __b) {
  832. return __a & __b;
  833. }
  834. static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
  835. vector short __b) {
  836. return (vector short)__a & __b;
  837. }
  838. static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
  839. vector bool short __b) {
  840. return __a & (vector short)__b;
  841. }
  842. static __inline__ vector unsigned short __ATTRS_o_ai
  843. vec_vand(vector unsigned short __a, vector unsigned short __b) {
  844. return __a & __b;
  845. }
  846. static __inline__ vector unsigned short __ATTRS_o_ai
  847. vec_vand(vector bool short __a, vector unsigned short __b) {
  848. return (vector unsigned short)__a & __b;
  849. }
  850. static __inline__ vector unsigned short __ATTRS_o_ai
  851. vec_vand(vector unsigned short __a, vector bool short __b) {
  852. return __a & (vector unsigned short)__b;
  853. }
  854. static __inline__ vector bool short __ATTRS_o_ai
  855. vec_vand(vector bool short __a, vector bool short __b) {
  856. return __a & __b;
  857. }
  858. static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
  859. vector int __b) {
  860. return __a & __b;
  861. }
  862. static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
  863. vector int __b) {
  864. return (vector int)__a & __b;
  865. }
  866. static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
  867. vector bool int __b) {
  868. return __a & (vector int)__b;
  869. }
  870. static __inline__ vector unsigned int __ATTRS_o_ai
  871. vec_vand(vector unsigned int __a, vector unsigned int __b) {
  872. return __a & __b;
  873. }
  874. static __inline__ vector unsigned int __ATTRS_o_ai
  875. vec_vand(vector bool int __a, vector unsigned int __b) {
  876. return (vector unsigned int)__a & __b;
  877. }
  878. static __inline__ vector unsigned int __ATTRS_o_ai
  879. vec_vand(vector unsigned int __a, vector bool int __b) {
  880. return __a & (vector unsigned int)__b;
  881. }
  882. static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
  883. vector bool int __b) {
  884. return __a & __b;
  885. }
  886. static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
  887. vector float __b) {
  888. vector unsigned int __res =
  889. (vector unsigned int)__a & (vector unsigned int)__b;
  890. return (vector float)__res;
  891. }
  892. static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
  893. vector float __b) {
  894. vector unsigned int __res =
  895. (vector unsigned int)__a & (vector unsigned int)__b;
  896. return (vector float)__res;
  897. }
  898. static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
  899. vector bool int __b) {
  900. vector unsigned int __res =
  901. (vector unsigned int)__a & (vector unsigned int)__b;
  902. return (vector float)__res;
  903. }
  904. #ifdef __VSX__
  905. static __inline__ vector signed long long __ATTRS_o_ai
  906. vec_vand(vector signed long long __a, vector signed long long __b) {
  907. return __a & __b;
  908. }
  909. static __inline__ vector signed long long __ATTRS_o_ai
  910. vec_vand(vector bool long long __a, vector signed long long __b) {
  911. return (vector signed long long)__a & __b;
  912. }
  913. static __inline__ vector signed long long __ATTRS_o_ai
  914. vec_vand(vector signed long long __a, vector bool long long __b) {
  915. return __a & (vector signed long long)__b;
  916. }
  917. static __inline__ vector unsigned long long __ATTRS_o_ai
  918. vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
  919. return __a & __b;
  920. }
  921. static __inline__ vector unsigned long long __ATTRS_o_ai
  922. vec_vand(vector bool long long __a, vector unsigned long long __b) {
  923. return (vector unsigned long long)__a & __b;
  924. }
  925. static __inline__ vector unsigned long long __ATTRS_o_ai
  926. vec_vand(vector unsigned long long __a, vector bool long long __b) {
  927. return __a & (vector unsigned long long)__b;
  928. }
  929. static __inline__ vector bool long long __ATTRS_o_ai
  930. vec_vand(vector bool long long __a, vector bool long long __b) {
  931. return __a & __b;
  932. }
  933. #endif
  934. /* vec_andc */
  935. #define __builtin_altivec_vandc vec_andc
  936. static __inline__ vector signed char __ATTRS_o_ai
  937. vec_andc(vector signed char __a, vector signed char __b) {
  938. return __a & ~__b;
  939. }
  940. static __inline__ vector signed char __ATTRS_o_ai
  941. vec_andc(vector bool char __a, vector signed char __b) {
  942. return (vector signed char)__a & ~__b;
  943. }
  944. static __inline__ vector signed char __ATTRS_o_ai
  945. vec_andc(vector signed char __a, vector bool char __b) {
  946. return __a & ~(vector signed char)__b;
  947. }
  948. static __inline__ vector unsigned char __ATTRS_o_ai
  949. vec_andc(vector unsigned char __a, vector unsigned char __b) {
  950. return __a & ~__b;
  951. }
  952. static __inline__ vector unsigned char __ATTRS_o_ai
  953. vec_andc(vector bool char __a, vector unsigned char __b) {
  954. return (vector unsigned char)__a & ~__b;
  955. }
  956. static __inline__ vector unsigned char __ATTRS_o_ai
  957. vec_andc(vector unsigned char __a, vector bool char __b) {
  958. return __a & ~(vector unsigned char)__b;
  959. }
  960. static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
  961. vector bool char __b) {
  962. return __a & ~__b;
  963. }
  964. static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
  965. vector short __b) {
  966. return __a & ~__b;
  967. }
  968. static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
  969. vector short __b) {
  970. return (vector short)__a & ~__b;
  971. }
  972. static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
  973. vector bool short __b) {
  974. return __a & ~(vector short)__b;
  975. }
  976. static __inline__ vector unsigned short __ATTRS_o_ai
  977. vec_andc(vector unsigned short __a, vector unsigned short __b) {
  978. return __a & ~__b;
  979. }
  980. static __inline__ vector unsigned short __ATTRS_o_ai
  981. vec_andc(vector bool short __a, vector unsigned short __b) {
  982. return (vector unsigned short)__a & ~__b;
  983. }
  984. static __inline__ vector unsigned short __ATTRS_o_ai
  985. vec_andc(vector unsigned short __a, vector bool short __b) {
  986. return __a & ~(vector unsigned short)__b;
  987. }
  988. static __inline__ vector bool short __ATTRS_o_ai
  989. vec_andc(vector bool short __a, vector bool short __b) {
  990. return __a & ~__b;
  991. }
  992. static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
  993. vector int __b) {
  994. return __a & ~__b;
  995. }
  996. static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
  997. vector int __b) {
  998. return (vector int)__a & ~__b;
  999. }
  1000. static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
  1001. vector bool int __b) {
  1002. return __a & ~(vector int)__b;
  1003. }
  1004. static __inline__ vector unsigned int __ATTRS_o_ai
  1005. vec_andc(vector unsigned int __a, vector unsigned int __b) {
  1006. return __a & ~__b;
  1007. }
  1008. static __inline__ vector unsigned int __ATTRS_o_ai
  1009. vec_andc(vector bool int __a, vector unsigned int __b) {
  1010. return (vector unsigned int)__a & ~__b;
  1011. }
  1012. static __inline__ vector unsigned int __ATTRS_o_ai
  1013. vec_andc(vector unsigned int __a, vector bool int __b) {
  1014. return __a & ~(vector unsigned int)__b;
  1015. }
  1016. static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
  1017. vector bool int __b) {
  1018. return __a & ~__b;
  1019. }
  1020. static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
  1021. vector float __b) {
  1022. vector unsigned int __res =
  1023. (vector unsigned int)__a & ~(vector unsigned int)__b;
  1024. return (vector float)__res;
  1025. }
  1026. static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
  1027. vector float __b) {
  1028. vector unsigned int __res =
  1029. (vector unsigned int)__a & ~(vector unsigned int)__b;
  1030. return (vector float)__res;
  1031. }
  1032. static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
  1033. vector bool int __b) {
  1034. vector unsigned int __res =
  1035. (vector unsigned int)__a & ~(vector unsigned int)__b;
  1036. return (vector float)__res;
  1037. }
  1038. #ifdef __VSX__
  1039. static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
  1040. vector double __b) {
  1041. vector unsigned long long __res =
  1042. (vector unsigned long long)__a & ~(vector unsigned long long)__b;
  1043. return (vector double)__res;
  1044. }
  1045. static __inline__ vector double __ATTRS_o_ai
  1046. vec_andc(vector double __a, vector bool long long __b) {
  1047. vector unsigned long long __res =
  1048. (vector unsigned long long)__a & ~(vector unsigned long long)__b;
  1049. return (vector double)__res;
  1050. }
  1051. static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
  1052. vector double __b) {
  1053. vector unsigned long long __res =
  1054. (vector unsigned long long)__a & ~(vector unsigned long long)__b;
  1055. return (vector double)__res;
  1056. }
  1057. static __inline__ vector signed long long __ATTRS_o_ai
  1058. vec_andc(vector signed long long __a, vector signed long long __b) {
  1059. return __a & ~__b;
  1060. }
  1061. static __inline__ vector signed long long __ATTRS_o_ai
  1062. vec_andc(vector bool long long __a, vector signed long long __b) {
  1063. return (vector signed long long)__a & ~__b;
  1064. }
  1065. static __inline__ vector signed long long __ATTRS_o_ai
  1066. vec_andc(vector signed long long __a, vector bool long long __b) {
  1067. return __a & ~(vector signed long long)__b;
  1068. }
  1069. static __inline__ vector unsigned long long __ATTRS_o_ai
  1070. vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
  1071. return __a & ~__b;
  1072. }
  1073. static __inline__ vector unsigned long long __ATTRS_o_ai
  1074. vec_andc(vector bool long long __a, vector unsigned long long __b) {
  1075. return (vector unsigned long long)__a & ~__b;
  1076. }
  1077. static __inline__ vector unsigned long long __ATTRS_o_ai
  1078. vec_andc(vector unsigned long long __a, vector bool long long __b) {
  1079. return __a & ~(vector unsigned long long)__b;
  1080. }
  1081. static __inline__ vector bool long long __ATTRS_o_ai
  1082. vec_andc(vector bool long long __a, vector bool long long __b) {
  1083. return __a & ~__b;
  1084. }
  1085. #endif
  1086. /* vec_vandc */
  1087. static __inline__ vector signed char __ATTRS_o_ai
  1088. vec_vandc(vector signed char __a, vector signed char __b) {
  1089. return __a & ~__b;
  1090. }
  1091. static __inline__ vector signed char __ATTRS_o_ai
  1092. vec_vandc(vector bool char __a, vector signed char __b) {
  1093. return (vector signed char)__a & ~__b;
  1094. }
  1095. static __inline__ vector signed char __ATTRS_o_ai
  1096. vec_vandc(vector signed char __a, vector bool char __b) {
  1097. return __a & ~(vector signed char)__b;
  1098. }
  1099. static __inline__ vector unsigned char __ATTRS_o_ai
  1100. vec_vandc(vector unsigned char __a, vector unsigned char __b) {
  1101. return __a & ~__b;
  1102. }
  1103. static __inline__ vector unsigned char __ATTRS_o_ai
  1104. vec_vandc(vector bool char __a, vector unsigned char __b) {
  1105. return (vector unsigned char)__a & ~__b;
  1106. }
  1107. static __inline__ vector unsigned char __ATTRS_o_ai
  1108. vec_vandc(vector unsigned char __a, vector bool char __b) {
  1109. return __a & ~(vector unsigned char)__b;
  1110. }
  1111. static __inline__ vector bool char __ATTRS_o_ai
  1112. vec_vandc(vector bool char __a, vector bool char __b) {
  1113. return __a & ~__b;
  1114. }
  1115. static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
  1116. vector short __b) {
  1117. return __a & ~__b;
  1118. }
  1119. static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
  1120. vector short __b) {
  1121. return (vector short)__a & ~__b;
  1122. }
  1123. static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
  1124. vector bool short __b) {
  1125. return __a & ~(vector short)__b;
  1126. }
  1127. static __inline__ vector unsigned short __ATTRS_o_ai
  1128. vec_vandc(vector unsigned short __a, vector unsigned short __b) {
  1129. return __a & ~__b;
  1130. }
  1131. static __inline__ vector unsigned short __ATTRS_o_ai
  1132. vec_vandc(vector bool short __a, vector unsigned short __b) {
  1133. return (vector unsigned short)__a & ~__b;
  1134. }
  1135. static __inline__ vector unsigned short __ATTRS_o_ai
  1136. vec_vandc(vector unsigned short __a, vector bool short __b) {
  1137. return __a & ~(vector unsigned short)__b;
  1138. }
  1139. static __inline__ vector bool short __ATTRS_o_ai
  1140. vec_vandc(vector bool short __a, vector bool short __b) {
  1141. return __a & ~__b;
  1142. }
  1143. static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
  1144. vector int __b) {
  1145. return __a & ~__b;
  1146. }
  1147. static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
  1148. vector int __b) {
  1149. return (vector int)__a & ~__b;
  1150. }
  1151. static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
  1152. vector bool int __b) {
  1153. return __a & ~(vector int)__b;
  1154. }
  1155. static __inline__ vector unsigned int __ATTRS_o_ai
  1156. vec_vandc(vector unsigned int __a, vector unsigned int __b) {
  1157. return __a & ~__b;
  1158. }
  1159. static __inline__ vector unsigned int __ATTRS_o_ai
  1160. vec_vandc(vector bool int __a, vector unsigned int __b) {
  1161. return (vector unsigned int)__a & ~__b;
  1162. }
  1163. static __inline__ vector unsigned int __ATTRS_o_ai
  1164. vec_vandc(vector unsigned int __a, vector bool int __b) {
  1165. return __a & ~(vector unsigned int)__b;
  1166. }
  1167. static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
  1168. vector bool int __b) {
  1169. return __a & ~__b;
  1170. }
  1171. static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
  1172. vector float __b) {
  1173. vector unsigned int __res =
  1174. (vector unsigned int)__a & ~(vector unsigned int)__b;
  1175. return (vector float)__res;
  1176. }
  1177. static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
  1178. vector float __b) {
  1179. vector unsigned int __res =
  1180. (vector unsigned int)__a & ~(vector unsigned int)__b;
  1181. return (vector float)__res;
  1182. }
  1183. static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
  1184. vector bool int __b) {
  1185. vector unsigned int __res =
  1186. (vector unsigned int)__a & ~(vector unsigned int)__b;
  1187. return (vector float)__res;
  1188. }
  1189. #ifdef __VSX__
  1190. static __inline__ vector signed long long __ATTRS_o_ai
  1191. vec_vandc(vector signed long long __a, vector signed long long __b) {
  1192. return __a & ~__b;
  1193. }
  1194. static __inline__ vector signed long long __ATTRS_o_ai
  1195. vec_vandc(vector bool long long __a, vector signed long long __b) {
  1196. return (vector signed long long)__a & ~__b;
  1197. }
  1198. static __inline__ vector signed long long __ATTRS_o_ai
  1199. vec_vandc(vector signed long long __a, vector bool long long __b) {
  1200. return __a & ~(vector signed long long)__b;
  1201. }
  1202. static __inline__ vector unsigned long long __ATTRS_o_ai
  1203. vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
  1204. return __a & ~__b;
  1205. }
  1206. static __inline__ vector unsigned long long __ATTRS_o_ai
  1207. vec_vandc(vector bool long long __a, vector unsigned long long __b) {
  1208. return (vector unsigned long long)__a & ~__b;
  1209. }
  1210. static __inline__ vector unsigned long long __ATTRS_o_ai
  1211. vec_vandc(vector unsigned long long __a, vector bool long long __b) {
  1212. return __a & ~(vector unsigned long long)__b;
  1213. }
  1214. static __inline__ vector bool long long __ATTRS_o_ai
  1215. vec_vandc(vector bool long long __a, vector bool long long __b) {
  1216. return __a & ~__b;
  1217. }
  1218. #endif
  1219. /* vec_avg */
  1220. static __inline__ vector signed char __ATTRS_o_ai
  1221. vec_avg(vector signed char __a, vector signed char __b) {
  1222. return __builtin_altivec_vavgsb(__a, __b);
  1223. }
  1224. static __inline__ vector unsigned char __ATTRS_o_ai
  1225. vec_avg(vector unsigned char __a, vector unsigned char __b) {
  1226. return __builtin_altivec_vavgub(__a, __b);
  1227. }
  1228. static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
  1229. vector short __b) {
  1230. return __builtin_altivec_vavgsh(__a, __b);
  1231. }
  1232. static __inline__ vector unsigned short __ATTRS_o_ai
  1233. vec_avg(vector unsigned short __a, vector unsigned short __b) {
  1234. return __builtin_altivec_vavguh(__a, __b);
  1235. }
  1236. static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
  1237. vector int __b) {
  1238. return __builtin_altivec_vavgsw(__a, __b);
  1239. }
  1240. static __inline__ vector unsigned int __ATTRS_o_ai
  1241. vec_avg(vector unsigned int __a, vector unsigned int __b) {
  1242. return __builtin_altivec_vavguw(__a, __b);
  1243. }
  1244. /* vec_vavgsb */
  1245. static __inline__ vector signed char __attribute__((__always_inline__))
  1246. vec_vavgsb(vector signed char __a, vector signed char __b) {
  1247. return __builtin_altivec_vavgsb(__a, __b);
  1248. }
  1249. /* vec_vavgub */
  1250. static __inline__ vector unsigned char __attribute__((__always_inline__))
  1251. vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
  1252. return __builtin_altivec_vavgub(__a, __b);
  1253. }
  1254. /* vec_vavgsh */
  1255. static __inline__ vector short __attribute__((__always_inline__))
  1256. vec_vavgsh(vector short __a, vector short __b) {
  1257. return __builtin_altivec_vavgsh(__a, __b);
  1258. }
  1259. /* vec_vavguh */
  1260. static __inline__ vector unsigned short __attribute__((__always_inline__))
  1261. vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
  1262. return __builtin_altivec_vavguh(__a, __b);
  1263. }
  1264. /* vec_vavgsw */
  1265. static __inline__ vector int __attribute__((__always_inline__))
  1266. vec_vavgsw(vector int __a, vector int __b) {
  1267. return __builtin_altivec_vavgsw(__a, __b);
  1268. }
  1269. /* vec_vavguw */
  1270. static __inline__ vector unsigned int __attribute__((__always_inline__))
  1271. vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
  1272. return __builtin_altivec_vavguw(__a, __b);
  1273. }
  1274. /* vec_ceil */
  1275. static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
  1276. #ifdef __VSX__
  1277. return __builtin_vsx_xvrspip(__a);
  1278. #else
  1279. return __builtin_altivec_vrfip(__a);
  1280. #endif
  1281. }
  1282. #ifdef __VSX__
  1283. static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
  1284. return __builtin_vsx_xvrdpip(__a);
  1285. }
  1286. #endif
  1287. /* vec_vrfip */
  1288. static __inline__ vector float __attribute__((__always_inline__))
  1289. vec_vrfip(vector float __a) {
  1290. return __builtin_altivec_vrfip(__a);
  1291. }
  1292. /* vec_cmpb */
  1293. static __inline__ vector int __attribute__((__always_inline__))
  1294. vec_cmpb(vector float __a, vector float __b) {
  1295. return __builtin_altivec_vcmpbfp(__a, __b);
  1296. }
  1297. /* vec_vcmpbfp */
  1298. static __inline__ vector int __attribute__((__always_inline__))
  1299. vec_vcmpbfp(vector float __a, vector float __b) {
  1300. return __builtin_altivec_vcmpbfp(__a, __b);
  1301. }
  1302. /* vec_cmpeq */
  1303. static __inline__ vector bool char __ATTRS_o_ai
  1304. vec_cmpeq(vector signed char __a, vector signed char __b) {
  1305. return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
  1306. (vector char)__b);
  1307. }
  1308. static __inline__ vector bool char __ATTRS_o_ai
  1309. vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
  1310. return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
  1311. (vector char)__b);
  1312. }
  1313. static __inline__ vector bool char __ATTRS_o_ai
  1314. vec_cmpeq(vector bool char __a, vector bool char __b) {
  1315. return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
  1316. (vector char)__b);
  1317. }
  1318. static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
  1319. vector short __b) {
  1320. return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
  1321. }
  1322. static __inline__ vector bool short __ATTRS_o_ai
  1323. vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
  1324. return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
  1325. (vector short)__b);
  1326. }
  1327. static __inline__ vector bool short __ATTRS_o_ai
  1328. vec_cmpeq(vector bool short __a, vector bool short __b) {
  1329. return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
  1330. (vector short)__b);
  1331. }
  1332. static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
  1333. vector int __b) {
  1334. return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
  1335. }
  1336. static __inline__ vector bool int __ATTRS_o_ai
  1337. vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
  1338. return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
  1339. (vector int)__b);
  1340. }
  1341. static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a,
  1342. vector bool int __b) {
  1343. return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
  1344. (vector int)__b);
  1345. }
  1346. #ifdef __POWER8_VECTOR__
  1347. static __inline__ vector bool long long __ATTRS_o_ai
  1348. vec_cmpeq(vector signed long long __a, vector signed long long __b) {
  1349. return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
  1350. }
  1351. static __inline__ vector bool long long __ATTRS_o_ai
  1352. vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
  1353. return (vector bool long long)__builtin_altivec_vcmpequd(
  1354. (vector long long)__a, (vector long long)__b);
  1355. }
  1356. static __inline__ vector bool long long __ATTRS_o_ai
  1357. vec_cmpeq(vector bool long long __a, vector bool long long __b) {
  1358. return (vector bool long long)__builtin_altivec_vcmpequd(
  1359. (vector long long)__a, (vector long long)__b);
  1360. }
  1361. #endif
  1362. static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
  1363. vector float __b) {
  1364. #ifdef __VSX__
  1365. return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
  1366. #else
  1367. return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
  1368. #endif
  1369. }
  1370. #ifdef __VSX__
  1371. static __inline__ vector bool long long __ATTRS_o_ai
  1372. vec_cmpeq(vector double __a, vector double __b) {
  1373. return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
  1374. }
  1375. #endif
  1376. #ifdef __POWER9_VECTOR__
  1377. /* vec_cmpne */
  1378. static __inline__ vector bool char __ATTRS_o_ai
  1379. vec_cmpne(vector bool char __a, vector bool char __b) {
  1380. return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
  1381. (vector char)__b);
  1382. }
  1383. static __inline__ vector bool char __ATTRS_o_ai
  1384. vec_cmpne(vector signed char __a, vector signed char __b) {
  1385. return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
  1386. (vector char)__b);
  1387. }
  1388. static __inline__ vector bool char __ATTRS_o_ai
  1389. vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
  1390. return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
  1391. (vector char)__b);
  1392. }
  1393. static __inline__ vector bool short __ATTRS_o_ai
  1394. vec_cmpne(vector bool short __a, vector bool short __b) {
  1395. return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
  1396. (vector short)__b);
  1397. }
  1398. static __inline__ vector bool short __ATTRS_o_ai
  1399. vec_cmpne(vector signed short __a, vector signed short __b) {
  1400. return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
  1401. (vector short)__b);
  1402. }
  1403. static __inline__ vector bool short __ATTRS_o_ai
  1404. vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
  1405. return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
  1406. (vector short)__b);
  1407. }
  1408. static __inline__ vector bool int __ATTRS_o_ai
  1409. vec_cmpne(vector bool int __a, vector bool int __b) {
  1410. return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
  1411. (vector int)__b);
  1412. }
  1413. static __inline__ vector bool int __ATTRS_o_ai
  1414. vec_cmpne(vector signed int __a, vector signed int __b) {
  1415. return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
  1416. (vector int)__b);
  1417. }
  1418. static __inline__ vector bool int __ATTRS_o_ai
  1419. vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
  1420. return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
  1421. (vector int)__b);
  1422. }
  1423. static __inline__ vector bool long long __ATTRS_o_ai
  1424. vec_cmpne(vector bool long long __a, vector bool long long __b) {
  1425. return (vector bool long long)
  1426. ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
  1427. }
  1428. static __inline__ vector bool long long __ATTRS_o_ai
  1429. vec_cmpne(vector signed long long __a, vector signed long long __b) {
  1430. return (vector bool long long)
  1431. ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
  1432. }
  1433. static __inline__ vector bool long long __ATTRS_o_ai
  1434. vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
  1435. return (vector bool long long)
  1436. ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
  1437. }
  1438. static __inline__ vector bool int __ATTRS_o_ai
  1439. vec_cmpne(vector float __a, vector float __b) {
  1440. return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
  1441. (vector int)__b);
  1442. }
  1443. static __inline__ vector bool long long __ATTRS_o_ai
  1444. vec_cmpne(vector double __a, vector double __b) {
  1445. return (vector bool long long)
  1446. ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
  1447. }
  1448. /* vec_cmpnez */
  1449. static __inline__ vector bool char __ATTRS_o_ai
  1450. vec_cmpnez(vector signed char __a, vector signed char __b) {
  1451. return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
  1452. (vector char)__b);
  1453. }
  1454. static __inline__ vector bool char __ATTRS_o_ai
  1455. vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
  1456. return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
  1457. (vector char)__b);
  1458. }
  1459. static __inline__ vector bool short __ATTRS_o_ai
  1460. vec_cmpnez(vector signed short __a, vector signed short __b) {
  1461. return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
  1462. (vector short)__b);
  1463. }
  1464. static __inline__ vector bool short __ATTRS_o_ai
  1465. vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
  1466. return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
  1467. (vector short)__b);
  1468. }
  1469. static __inline__ vector bool int __ATTRS_o_ai
  1470. vec_cmpnez(vector signed int __a, vector signed int __b) {
  1471. return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
  1472. (vector int)__b);
  1473. }
  1474. static __inline__ vector bool int __ATTRS_o_ai
  1475. vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
  1476. return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
  1477. (vector int)__b);
  1478. }
  1479. static __inline__ signed int __ATTRS_o_ai
  1480. vec_cntlz_lsbb(vector signed char __a) {
  1481. #ifdef __LITTLE_ENDIAN__
  1482. return __builtin_altivec_vctzlsbb(__a);
  1483. #else
  1484. return __builtin_altivec_vclzlsbb(__a);
  1485. #endif
  1486. }
  1487. static __inline__ signed int __ATTRS_o_ai
  1488. vec_cntlz_lsbb(vector unsigned char __a) {
  1489. #ifdef __LITTLE_ENDIAN__
  1490. return __builtin_altivec_vctzlsbb(__a);
  1491. #else
  1492. return __builtin_altivec_vclzlsbb(__a);
  1493. #endif
  1494. }
  1495. static __inline__ signed int __ATTRS_o_ai
  1496. vec_cnttz_lsbb(vector signed char __a) {
  1497. #ifdef __LITTLE_ENDIAN__
  1498. return __builtin_altivec_vclzlsbb(__a);
  1499. #else
  1500. return __builtin_altivec_vctzlsbb(__a);
  1501. #endif
  1502. }
  1503. static __inline__ signed int __ATTRS_o_ai
  1504. vec_cnttz_lsbb(vector unsigned char __a) {
  1505. #ifdef __LITTLE_ENDIAN__
  1506. return __builtin_altivec_vclzlsbb(__a);
  1507. #else
  1508. return __builtin_altivec_vctzlsbb(__a);
  1509. #endif
  1510. }
  1511. static __inline__ vector unsigned int __ATTRS_o_ai
  1512. vec_parity_lsbb(vector unsigned int __a) {
  1513. return __builtin_altivec_vprtybw(__a);
  1514. }
  1515. static __inline__ vector unsigned int __ATTRS_o_ai
  1516. vec_parity_lsbb(vector signed int __a) {
  1517. return __builtin_altivec_vprtybw(__a);
  1518. }
  1519. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  1520. vec_parity_lsbb(vector unsigned __int128 __a) {
  1521. return __builtin_altivec_vprtybq(__a);
  1522. }
  1523. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  1524. vec_parity_lsbb(vector signed __int128 __a) {
  1525. return __builtin_altivec_vprtybq(__a);
  1526. }
  1527. static __inline__ vector unsigned long long __ATTRS_o_ai
  1528. vec_parity_lsbb(vector unsigned long long __a) {
  1529. return __builtin_altivec_vprtybd(__a);
  1530. }
  1531. static __inline__ vector unsigned long long __ATTRS_o_ai
  1532. vec_parity_lsbb(vector signed long long __a) {
  1533. return __builtin_altivec_vprtybd(__a);
  1534. }
  1535. #endif
  1536. /* vec_cmpgt */
  1537. static __inline__ vector bool char __ATTRS_o_ai
  1538. vec_cmpgt(vector signed char __a, vector signed char __b) {
  1539. return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
  1540. }
  1541. static __inline__ vector bool char __ATTRS_o_ai
  1542. vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
  1543. return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
  1544. }
  1545. static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
  1546. vector short __b) {
  1547. return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
  1548. }
  1549. static __inline__ vector bool short __ATTRS_o_ai
  1550. vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
  1551. return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
  1552. }
  1553. static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
  1554. vector int __b) {
  1555. return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
  1556. }
  1557. static __inline__ vector bool int __ATTRS_o_ai
  1558. vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
  1559. return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
  1560. }
  1561. #ifdef __POWER8_VECTOR__
  1562. static __inline__ vector bool long long __ATTRS_o_ai
  1563. vec_cmpgt(vector signed long long __a, vector signed long long __b) {
  1564. return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
  1565. }
  1566. static __inline__ vector bool long long __ATTRS_o_ai
  1567. vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
  1568. return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
  1569. }
  1570. #endif
  1571. static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
  1572. vector float __b) {
  1573. #ifdef __VSX__
  1574. return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
  1575. #else
  1576. return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
  1577. #endif
  1578. }
  1579. #ifdef __VSX__
  1580. static __inline__ vector bool long long __ATTRS_o_ai
  1581. vec_cmpgt(vector double __a, vector double __b) {
  1582. return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
  1583. }
  1584. #endif
  1585. /* vec_cmpge */
  1586. static __inline__ vector bool char __ATTRS_o_ai
  1587. vec_cmpge(vector signed char __a, vector signed char __b) {
  1588. return ~(vec_cmpgt(__b, __a));
  1589. }
  1590. static __inline__ vector bool char __ATTRS_o_ai
  1591. vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
  1592. return ~(vec_cmpgt(__b, __a));
  1593. }
  1594. static __inline__ vector bool short __ATTRS_o_ai
  1595. vec_cmpge(vector signed short __a, vector signed short __b) {
  1596. return ~(vec_cmpgt(__b, __a));
  1597. }
  1598. static __inline__ vector bool short __ATTRS_o_ai
  1599. vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
  1600. return ~(vec_cmpgt(__b, __a));
  1601. }
  1602. static __inline__ vector bool int __ATTRS_o_ai
  1603. vec_cmpge(vector signed int __a, vector signed int __b) {
  1604. return ~(vec_cmpgt(__b, __a));
  1605. }
  1606. static __inline__ vector bool int __ATTRS_o_ai
  1607. vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
  1608. return ~(vec_cmpgt(__b, __a));
  1609. }
  1610. static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
  1611. vector float __b) {
  1612. #ifdef __VSX__
  1613. return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
  1614. #else
  1615. return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
  1616. #endif
  1617. }
  1618. #ifdef __VSX__
  1619. static __inline__ vector bool long long __ATTRS_o_ai
  1620. vec_cmpge(vector double __a, vector double __b) {
  1621. return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
  1622. }
  1623. #endif
  1624. #ifdef __POWER8_VECTOR__
  1625. static __inline__ vector bool long long __ATTRS_o_ai
  1626. vec_cmpge(vector signed long long __a, vector signed long long __b) {
  1627. return ~(vec_cmpgt(__b, __a));
  1628. }
  1629. static __inline__ vector bool long long __ATTRS_o_ai
  1630. vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
  1631. return ~(vec_cmpgt(__b, __a));
  1632. }
  1633. #endif
  1634. /* vec_vcmpgefp */
  1635. static __inline__ vector bool int __attribute__((__always_inline__))
  1636. vec_vcmpgefp(vector float __a, vector float __b) {
  1637. return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
  1638. }
  1639. /* vec_vcmpgtsb */
  1640. static __inline__ vector bool char __attribute__((__always_inline__))
  1641. vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
  1642. return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
  1643. }
  1644. /* vec_vcmpgtub */
  1645. static __inline__ vector bool char __attribute__((__always_inline__))
  1646. vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
  1647. return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
  1648. }
  1649. /* vec_vcmpgtsh */
  1650. static __inline__ vector bool short __attribute__((__always_inline__))
  1651. vec_vcmpgtsh(vector short __a, vector short __b) {
  1652. return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
  1653. }
  1654. /* vec_vcmpgtuh */
  1655. static __inline__ vector bool short __attribute__((__always_inline__))
  1656. vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
  1657. return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
  1658. }
  1659. /* vec_vcmpgtsw */
  1660. static __inline__ vector bool int __attribute__((__always_inline__))
  1661. vec_vcmpgtsw(vector int __a, vector int __b) {
  1662. return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
  1663. }
  1664. /* vec_vcmpgtuw */
  1665. static __inline__ vector bool int __attribute__((__always_inline__))
  1666. vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
  1667. return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
  1668. }
  1669. /* vec_vcmpgtfp */
  1670. static __inline__ vector bool int __attribute__((__always_inline__))
  1671. vec_vcmpgtfp(vector float __a, vector float __b) {
  1672. return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
  1673. }
  1674. /* vec_cmple */
  1675. static __inline__ vector bool char __ATTRS_o_ai
  1676. vec_cmple(vector signed char __a, vector signed char __b) {
  1677. return vec_cmpge(__b, __a);
  1678. }
  1679. static __inline__ vector bool char __ATTRS_o_ai
  1680. vec_cmple(vector unsigned char __a, vector unsigned char __b) {
  1681. return vec_cmpge(__b, __a);
  1682. }
  1683. static __inline__ vector bool short __ATTRS_o_ai
  1684. vec_cmple(vector signed short __a, vector signed short __b) {
  1685. return vec_cmpge(__b, __a);
  1686. }
  1687. static __inline__ vector bool short __ATTRS_o_ai
  1688. vec_cmple(vector unsigned short __a, vector unsigned short __b) {
  1689. return vec_cmpge(__b, __a);
  1690. }
  1691. static __inline__ vector bool int __ATTRS_o_ai
  1692. vec_cmple(vector signed int __a, vector signed int __b) {
  1693. return vec_cmpge(__b, __a);
  1694. }
  1695. static __inline__ vector bool int __ATTRS_o_ai
  1696. vec_cmple(vector unsigned int __a, vector unsigned int __b) {
  1697. return vec_cmpge(__b, __a);
  1698. }
  1699. static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
  1700. vector float __b) {
  1701. return vec_cmpge(__b, __a);
  1702. }
  1703. #ifdef __VSX__
  1704. static __inline__ vector bool long long __ATTRS_o_ai
  1705. vec_cmple(vector double __a, vector double __b) {
  1706. return vec_cmpge(__b, __a);
  1707. }
  1708. #endif
  1709. #ifdef __POWER8_VECTOR__
  1710. static __inline__ vector bool long long __ATTRS_o_ai
  1711. vec_cmple(vector signed long long __a, vector signed long long __b) {
  1712. return vec_cmpge(__b, __a);
  1713. }
  1714. static __inline__ vector bool long long __ATTRS_o_ai
  1715. vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
  1716. return vec_cmpge(__b, __a);
  1717. }
  1718. #endif
  1719. /* vec_cmplt */
  1720. static __inline__ vector bool char __ATTRS_o_ai
  1721. vec_cmplt(vector signed char __a, vector signed char __b) {
  1722. return vec_cmpgt(__b, __a);
  1723. }
  1724. static __inline__ vector bool char __ATTRS_o_ai
  1725. vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
  1726. return vec_cmpgt(__b, __a);
  1727. }
  1728. static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
  1729. vector short __b) {
  1730. return vec_cmpgt(__b, __a);
  1731. }
  1732. static __inline__ vector bool short __ATTRS_o_ai
  1733. vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
  1734. return vec_cmpgt(__b, __a);
  1735. }
  1736. static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
  1737. vector int __b) {
  1738. return vec_cmpgt(__b, __a);
  1739. }
  1740. static __inline__ vector bool int __ATTRS_o_ai
  1741. vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
  1742. return vec_cmpgt(__b, __a);
  1743. }
  1744. static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
  1745. vector float __b) {
  1746. return vec_cmpgt(__b, __a);
  1747. }
  1748. #ifdef __VSX__
  1749. static __inline__ vector bool long long __ATTRS_o_ai
  1750. vec_cmplt(vector double __a, vector double __b) {
  1751. return vec_cmpgt(__b, __a);
  1752. }
  1753. #endif
  1754. #ifdef __POWER8_VECTOR__
  1755. static __inline__ vector bool long long __ATTRS_o_ai
  1756. vec_cmplt(vector signed long long __a, vector signed long long __b) {
  1757. return vec_cmpgt(__b, __a);
  1758. }
  1759. static __inline__ vector bool long long __ATTRS_o_ai
  1760. vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
  1761. return vec_cmpgt(__b, __a);
  1762. }
  1763. /* vec_popcnt */
  1764. static __inline__ vector signed char __ATTRS_o_ai
  1765. vec_popcnt(vector signed char __a) {
  1766. return __builtin_altivec_vpopcntb(__a);
  1767. }
  1768. static __inline__ vector unsigned char __ATTRS_o_ai
  1769. vec_popcnt(vector unsigned char __a) {
  1770. return __builtin_altivec_vpopcntb(__a);
  1771. }
  1772. static __inline__ vector signed short __ATTRS_o_ai
  1773. vec_popcnt(vector signed short __a) {
  1774. return __builtin_altivec_vpopcnth(__a);
  1775. }
  1776. static __inline__ vector unsigned short __ATTRS_o_ai
  1777. vec_popcnt(vector unsigned short __a) {
  1778. return __builtin_altivec_vpopcnth(__a);
  1779. }
  1780. static __inline__ vector signed int __ATTRS_o_ai
  1781. vec_popcnt(vector signed int __a) {
  1782. return __builtin_altivec_vpopcntw(__a);
  1783. }
  1784. static __inline__ vector unsigned int __ATTRS_o_ai
  1785. vec_popcnt(vector unsigned int __a) {
  1786. return __builtin_altivec_vpopcntw(__a);
  1787. }
  1788. static __inline__ vector signed long long __ATTRS_o_ai
  1789. vec_popcnt(vector signed long long __a) {
  1790. return __builtin_altivec_vpopcntd(__a);
  1791. }
  1792. static __inline__ vector unsigned long long __ATTRS_o_ai
  1793. vec_popcnt(vector unsigned long long __a) {
  1794. return __builtin_altivec_vpopcntd(__a);
  1795. }
  1796. /* vec_cntlz */
  1797. static __inline__ vector signed char __ATTRS_o_ai
  1798. vec_cntlz(vector signed char __a) {
  1799. return __builtin_altivec_vclzb(__a);
  1800. }
  1801. static __inline__ vector unsigned char __ATTRS_o_ai
  1802. vec_cntlz(vector unsigned char __a) {
  1803. return __builtin_altivec_vclzb(__a);
  1804. }
  1805. static __inline__ vector signed short __ATTRS_o_ai
  1806. vec_cntlz(vector signed short __a) {
  1807. return __builtin_altivec_vclzh(__a);
  1808. }
  1809. static __inline__ vector unsigned short __ATTRS_o_ai
  1810. vec_cntlz(vector unsigned short __a) {
  1811. return __builtin_altivec_vclzh(__a);
  1812. }
  1813. static __inline__ vector signed int __ATTRS_o_ai
  1814. vec_cntlz(vector signed int __a) {
  1815. return __builtin_altivec_vclzw(__a);
  1816. }
  1817. static __inline__ vector unsigned int __ATTRS_o_ai
  1818. vec_cntlz(vector unsigned int __a) {
  1819. return __builtin_altivec_vclzw(__a);
  1820. }
  1821. static __inline__ vector signed long long __ATTRS_o_ai
  1822. vec_cntlz(vector signed long long __a) {
  1823. return __builtin_altivec_vclzd(__a);
  1824. }
  1825. static __inline__ vector unsigned long long __ATTRS_o_ai
  1826. vec_cntlz(vector unsigned long long __a) {
  1827. return __builtin_altivec_vclzd(__a);
  1828. }
  1829. #endif
  1830. #ifdef __POWER9_VECTOR__
  1831. /* vec_cnttz */
  1832. static __inline__ vector signed char __ATTRS_o_ai
  1833. vec_cnttz(vector signed char __a) {
  1834. return __builtin_altivec_vctzb(__a);
  1835. }
  1836. static __inline__ vector unsigned char __ATTRS_o_ai
  1837. vec_cnttz(vector unsigned char __a) {
  1838. return __builtin_altivec_vctzb(__a);
  1839. }
  1840. static __inline__ vector signed short __ATTRS_o_ai
  1841. vec_cnttz(vector signed short __a) {
  1842. return __builtin_altivec_vctzh(__a);
  1843. }
  1844. static __inline__ vector unsigned short __ATTRS_o_ai
  1845. vec_cnttz(vector unsigned short __a) {
  1846. return __builtin_altivec_vctzh(__a);
  1847. }
  1848. static __inline__ vector signed int __ATTRS_o_ai
  1849. vec_cnttz(vector signed int __a) {
  1850. return __builtin_altivec_vctzw(__a);
  1851. }
  1852. static __inline__ vector unsigned int __ATTRS_o_ai
  1853. vec_cnttz(vector unsigned int __a) {
  1854. return __builtin_altivec_vctzw(__a);
  1855. }
  1856. static __inline__ vector signed long long __ATTRS_o_ai
  1857. vec_cnttz(vector signed long long __a) {
  1858. return __builtin_altivec_vctzd(__a);
  1859. }
  1860. static __inline__ vector unsigned long long __ATTRS_o_ai
  1861. vec_cnttz(vector unsigned long long __a) {
  1862. return __builtin_altivec_vctzd(__a);
  1863. }
  1864. /* vec_first_match_index */
  1865. static __inline__ unsigned __ATTRS_o_ai
  1866. vec_first_match_index(vector signed char __a, vector signed char __b) {
  1867. vector unsigned long long __res =
  1868. #ifdef __LITTLE_ENDIAN__
  1869. vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
  1870. #else
  1871. vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
  1872. #endif
  1873. if (__res[0] == 64) {
  1874. return (__res[1] + 64) >> 3;
  1875. }
  1876. return __res[0] >> 3;
  1877. }
  1878. static __inline__ unsigned __ATTRS_o_ai
  1879. vec_first_match_index(vector unsigned char __a, vector unsigned char __b) {
  1880. vector unsigned long long __res =
  1881. #ifdef __LITTLE_ENDIAN__
  1882. vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
  1883. #else
  1884. vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
  1885. #endif
  1886. if (__res[0] == 64) {
  1887. return (__res[1] + 64) >> 3;
  1888. }
  1889. return __res[0] >> 3;
  1890. }
  1891. static __inline__ unsigned __ATTRS_o_ai
  1892. vec_first_match_index(vector signed short __a, vector signed short __b) {
  1893. vector unsigned long long __res =
  1894. #ifdef __LITTLE_ENDIAN__
  1895. vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
  1896. #else
  1897. vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
  1898. #endif
  1899. if (__res[0] == 64) {
  1900. return (__res[1] + 64) >> 4;
  1901. }
  1902. return __res[0] >> 4;
  1903. }
  1904. static __inline__ unsigned __ATTRS_o_ai
  1905. vec_first_match_index(vector unsigned short __a, vector unsigned short __b) {
  1906. vector unsigned long long __res =
  1907. #ifdef __LITTLE_ENDIAN__
  1908. vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
  1909. #else
  1910. vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
  1911. #endif
  1912. if (__res[0] == 64) {
  1913. return (__res[1] + 64) >> 4;
  1914. }
  1915. return __res[0] >> 4;
  1916. }
  1917. static __inline__ unsigned __ATTRS_o_ai
  1918. vec_first_match_index(vector signed int __a, vector signed int __b) {
  1919. vector unsigned long long __res =
  1920. #ifdef __LITTLE_ENDIAN__
  1921. vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
  1922. #else
  1923. vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
  1924. #endif
  1925. if (__res[0] == 64) {
  1926. return (__res[1] + 64) >> 5;
  1927. }
  1928. return __res[0] >> 5;
  1929. }
  1930. static __inline__ unsigned __ATTRS_o_ai
  1931. vec_first_match_index(vector unsigned int __a, vector unsigned int __b) {
  1932. vector unsigned long long __res =
  1933. #ifdef __LITTLE_ENDIAN__
  1934. vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
  1935. #else
  1936. vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
  1937. #endif
  1938. if (__res[0] == 64) {
  1939. return (__res[1] + 64) >> 5;
  1940. }
  1941. return __res[0] >> 5;
  1942. }
  1943. /* vec_first_match_or_eos_index */
  1944. static __inline__ unsigned __ATTRS_o_ai
  1945. vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) {
  1946. /* Compare the result of the comparison of two vectors with either and OR the
  1947. result. Either the elements are equal or one will equal the comparison
  1948. result if either is zero.
  1949. */
  1950. vector bool char __tmp1 = vec_cmpeq(__a, __b);
  1951. vector bool char __tmp2 = __tmp1 |
  1952. vec_cmpeq((vector signed char)__tmp1, __a) |
  1953. vec_cmpeq((vector signed char)__tmp1, __b);
  1954. vector unsigned long long __res =
  1955. #ifdef __LITTLE_ENDIAN__
  1956. vec_cnttz((vector unsigned long long)__tmp2);
  1957. #else
  1958. vec_cntlz((vector unsigned long long)__tmp2);
  1959. #endif
  1960. if (__res[0] == 64) {
  1961. return (__res[1] + 64) >> 3;
  1962. }
  1963. return __res[0] >> 3;
  1964. }
  1965. static __inline__ unsigned __ATTRS_o_ai
  1966. vec_first_match_or_eos_index(vector unsigned char __a,
  1967. vector unsigned char __b) {
  1968. vector bool char __tmp1 = vec_cmpeq(__a, __b);
  1969. vector bool char __tmp2 = __tmp1 |
  1970. vec_cmpeq((vector unsigned char)__tmp1, __a) |
  1971. vec_cmpeq((vector unsigned char)__tmp1, __b);
  1972. vector unsigned long long __res =
  1973. #ifdef __LITTLE_ENDIAN__
  1974. vec_cnttz((vector unsigned long long)__tmp2);
  1975. #else
  1976. vec_cntlz((vector unsigned long long)__tmp2);
  1977. #endif
  1978. if (__res[0] == 64) {
  1979. return (__res[1] + 64) >> 3;
  1980. }
  1981. return __res[0] >> 3;
  1982. }
  1983. static __inline__ unsigned __ATTRS_o_ai
  1984. vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) {
  1985. vector bool short __tmp1 = vec_cmpeq(__a, __b);
  1986. vector bool short __tmp2 = __tmp1 |
  1987. vec_cmpeq((vector signed short)__tmp1, __a) |
  1988. vec_cmpeq((vector signed short)__tmp1, __b);
  1989. vector unsigned long long __res =
  1990. #ifdef __LITTLE_ENDIAN__
  1991. vec_cnttz((vector unsigned long long)__tmp2);
  1992. #else
  1993. vec_cntlz((vector unsigned long long)__tmp2);
  1994. #endif
  1995. if (__res[0] == 64) {
  1996. return (__res[1] + 64) >> 4;
  1997. }
  1998. return __res[0] >> 4;
  1999. }
  2000. static __inline__ unsigned __ATTRS_o_ai
  2001. vec_first_match_or_eos_index(vector unsigned short __a,
  2002. vector unsigned short __b) {
  2003. vector bool short __tmp1 = vec_cmpeq(__a, __b);
  2004. vector bool short __tmp2 = __tmp1 |
  2005. vec_cmpeq((vector unsigned short)__tmp1, __a) |
  2006. vec_cmpeq((vector unsigned short)__tmp1, __b);
  2007. vector unsigned long long __res =
  2008. #ifdef __LITTLE_ENDIAN__
  2009. vec_cnttz((vector unsigned long long)__tmp2);
  2010. #else
  2011. vec_cntlz((vector unsigned long long)__tmp2);
  2012. #endif
  2013. if (__res[0] == 64) {
  2014. return (__res[1] + 64) >> 4;
  2015. }
  2016. return __res[0] >> 4;
  2017. }
  2018. static __inline__ unsigned __ATTRS_o_ai
  2019. vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) {
  2020. vector bool int __tmp1 = vec_cmpeq(__a, __b);
  2021. vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) |
  2022. vec_cmpeq((vector signed int)__tmp1, __b);
  2023. vector unsigned long long __res =
  2024. #ifdef __LITTLE_ENDIAN__
  2025. vec_cnttz((vector unsigned long long)__tmp2);
  2026. #else
  2027. vec_cntlz((vector unsigned long long)__tmp2);
  2028. #endif
  2029. if (__res[0] == 64) {
  2030. return (__res[1] + 64) >> 5;
  2031. }
  2032. return __res[0] >> 5;
  2033. }
  2034. static __inline__ unsigned __ATTRS_o_ai
  2035. vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) {
  2036. vector bool int __tmp1 = vec_cmpeq(__a, __b);
  2037. vector bool int __tmp2 = __tmp1 |
  2038. vec_cmpeq((vector unsigned int)__tmp1, __a) |
  2039. vec_cmpeq((vector unsigned int)__tmp1, __b);
  2040. vector unsigned long long __res =
  2041. #ifdef __LITTLE_ENDIAN__
  2042. vec_cnttz((vector unsigned long long)__tmp2);
  2043. #else
  2044. vec_cntlz((vector unsigned long long)__tmp2);
  2045. #endif
  2046. if (__res[0] == 64) {
  2047. return (__res[1] + 64) >> 5;
  2048. }
  2049. return __res[0] >> 5;
  2050. }
  2051. /* vec_first_mismatch_index */
  2052. static __inline__ unsigned __ATTRS_o_ai
  2053. vec_first_mismatch_index(vector signed char __a, vector signed char __b) {
  2054. vector unsigned long long __res =
  2055. #ifdef __LITTLE_ENDIAN__
  2056. vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
  2057. #else
  2058. vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
  2059. #endif
  2060. if (__res[0] == 64) {
  2061. return (__res[1] + 64) >> 3;
  2062. }
  2063. return __res[0] >> 3;
  2064. }
  2065. static __inline__ unsigned __ATTRS_o_ai
  2066. vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) {
  2067. vector unsigned long long __res =
  2068. #ifdef __LITTLE_ENDIAN__
  2069. vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
  2070. #else
  2071. vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
  2072. #endif
  2073. if (__res[0] == 64) {
  2074. return (__res[1] + 64) >> 3;
  2075. }
  2076. return __res[0] >> 3;
  2077. }
  2078. static __inline__ unsigned __ATTRS_o_ai
  2079. vec_first_mismatch_index(vector signed short __a, vector signed short __b) {
  2080. vector unsigned long long __res =
  2081. #ifdef __LITTLE_ENDIAN__
  2082. vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
  2083. #else
  2084. vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
  2085. #endif
  2086. if (__res[0] == 64) {
  2087. return (__res[1] + 64) >> 4;
  2088. }
  2089. return __res[0] >> 4;
  2090. }
  2091. static __inline__ unsigned __ATTRS_o_ai
  2092. vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) {
  2093. vector unsigned long long __res =
  2094. #ifdef __LITTLE_ENDIAN__
  2095. vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
  2096. #else
  2097. vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
  2098. #endif
  2099. if (__res[0] == 64) {
  2100. return (__res[1] + 64) >> 4;
  2101. }
  2102. return __res[0] >> 4;
  2103. }
  2104. static __inline__ unsigned __ATTRS_o_ai
  2105. vec_first_mismatch_index(vector signed int __a, vector signed int __b) {
  2106. vector unsigned long long __res =
  2107. #ifdef __LITTLE_ENDIAN__
  2108. vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
  2109. #else
  2110. vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
  2111. #endif
  2112. if (__res[0] == 64) {
  2113. return (__res[1] + 64) >> 5;
  2114. }
  2115. return __res[0] >> 5;
  2116. }
  2117. static __inline__ unsigned __ATTRS_o_ai
  2118. vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) {
  2119. vector unsigned long long __res =
  2120. #ifdef __LITTLE_ENDIAN__
  2121. vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
  2122. #else
  2123. vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
  2124. #endif
  2125. if (__res[0] == 64) {
  2126. return (__res[1] + 64) >> 5;
  2127. }
  2128. return __res[0] >> 5;
  2129. }
  2130. /* vec_first_mismatch_or_eos_index */
  2131. static __inline__ unsigned __ATTRS_o_ai
  2132. vec_first_mismatch_or_eos_index(vector signed char __a,
  2133. vector signed char __b) {
  2134. vector unsigned long long __res =
  2135. #ifdef __LITTLE_ENDIAN__
  2136. vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
  2137. #else
  2138. vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
  2139. #endif
  2140. if (__res[0] == 64) {
  2141. return (__res[1] + 64) >> 3;
  2142. }
  2143. return __res[0] >> 3;
  2144. }
  2145. static __inline__ unsigned __ATTRS_o_ai
  2146. vec_first_mismatch_or_eos_index(vector unsigned char __a,
  2147. vector unsigned char __b) {
  2148. vector unsigned long long __res =
  2149. #ifdef __LITTLE_ENDIAN__
  2150. vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
  2151. #else
  2152. vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
  2153. #endif
  2154. if (__res[0] == 64) {
  2155. return (__res[1] + 64) >> 3;
  2156. }
  2157. return __res[0] >> 3;
  2158. }
  2159. static __inline__ unsigned __ATTRS_o_ai
  2160. vec_first_mismatch_or_eos_index(vector signed short __a,
  2161. vector signed short __b) {
  2162. vector unsigned long long __res =
  2163. #ifdef __LITTLE_ENDIAN__
  2164. vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
  2165. #else
  2166. vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
  2167. #endif
  2168. if (__res[0] == 64) {
  2169. return (__res[1] + 64) >> 4;
  2170. }
  2171. return __res[0] >> 4;
  2172. }
  2173. static __inline__ unsigned __ATTRS_o_ai
  2174. vec_first_mismatch_or_eos_index(vector unsigned short __a,
  2175. vector unsigned short __b) {
  2176. vector unsigned long long __res =
  2177. #ifdef __LITTLE_ENDIAN__
  2178. vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
  2179. #else
  2180. vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
  2181. #endif
  2182. if (__res[0] == 64) {
  2183. return (__res[1] + 64) >> 4;
  2184. }
  2185. return __res[0] >> 4;
  2186. }
  2187. static __inline__ unsigned __ATTRS_o_ai
  2188. vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) {
  2189. vector unsigned long long __res =
  2190. #ifdef __LITTLE_ENDIAN__
  2191. vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
  2192. #else
  2193. vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
  2194. #endif
  2195. if (__res[0] == 64) {
  2196. return (__res[1] + 64) >> 5;
  2197. }
  2198. return __res[0] >> 5;
  2199. }
  2200. static __inline__ unsigned __ATTRS_o_ai
  2201. vec_first_mismatch_or_eos_index(vector unsigned int __a,
  2202. vector unsigned int __b) {
  2203. vector unsigned long long __res =
  2204. #ifdef __LITTLE_ENDIAN__
  2205. vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
  2206. #else
  2207. vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
  2208. #endif
  2209. if (__res[0] == 64) {
  2210. return (__res[1] + 64) >> 5;
  2211. }
  2212. return __res[0] >> 5;
  2213. }
  2214. static __inline__ vector double __ATTRS_o_ai
  2215. vec_insert_exp(vector double __a, vector unsigned long long __b) {
  2216. return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
  2217. }
  2218. static __inline__ vector double __ATTRS_o_ai
  2219. vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
  2220. return __builtin_vsx_xviexpdp(__a,__b);
  2221. }
  2222. static __inline__ vector float __ATTRS_o_ai
  2223. vec_insert_exp(vector float __a, vector unsigned int __b) {
  2224. return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
  2225. }
  2226. static __inline__ vector float __ATTRS_o_ai
  2227. vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
  2228. return __builtin_vsx_xviexpsp(__a,__b);
  2229. }
  2230. #if defined(__powerpc64__)
  2231. static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(signed char *__a,
  2232. size_t __b) {
  2233. return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56));
  2234. }
  2235. static __inline__ vector unsigned char __ATTRS_o_ai
  2236. vec_xl_len(unsigned char *__a, size_t __b) {
  2237. return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
  2238. }
  2239. static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(signed short *__a,
  2240. size_t __b) {
  2241. return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56));
  2242. }
  2243. static __inline__ vector unsigned short __ATTRS_o_ai
  2244. vec_xl_len(unsigned short *__a, size_t __b) {
  2245. return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
  2246. }
  2247. static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(signed int *__a,
  2248. size_t __b) {
  2249. return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56));
  2250. }
  2251. static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(unsigned int *__a,
  2252. size_t __b) {
  2253. return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56));
  2254. }
  2255. static __inline__ vector float __ATTRS_o_ai vec_xl_len(float *__a, size_t __b) {
  2256. return (vector float)__builtin_vsx_lxvl(__a, (__b << 56));
  2257. }
  2258. static __inline__ vector signed __int128 __ATTRS_o_ai
  2259. vec_xl_len(signed __int128 *__a, size_t __b) {
  2260. return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
  2261. }
  2262. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  2263. vec_xl_len(unsigned __int128 *__a, size_t __b) {
  2264. return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
  2265. }
  2266. static __inline__ vector signed long long __ATTRS_o_ai
  2267. vec_xl_len(signed long long *__a, size_t __b) {
  2268. return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
  2269. }
  2270. static __inline__ vector unsigned long long __ATTRS_o_ai
  2271. vec_xl_len(unsigned long long *__a, size_t __b) {
  2272. return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
  2273. }
  2274. static __inline__ vector double __ATTRS_o_ai vec_xl_len(double *__a,
  2275. size_t __b) {
  2276. return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
  2277. }
  2278. static __inline__ vector double __ATTRS_o_ai vec_xl_len_r(unsigned char *__a,
  2279. size_t __b) {
  2280. vector unsigned char __res =
  2281. (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
  2282. #ifdef __LITTLE_ENDIAN__
  2283. vector unsigned char __mask =
  2284. (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL);
  2285. __res = (vector unsigned char)__builtin_altivec_vperm_4si(
  2286. (vector int)__res, (vector int)__res, __mask);
  2287. #endif
  2288. return __res;
  2289. }
  2290. // vec_xst_len
  2291. static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a,
  2292. unsigned char *__b,
  2293. size_t __c) {
  2294. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2295. }
  2296. static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a,
  2297. signed char *__b, size_t __c) {
  2298. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2299. }
  2300. static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a,
  2301. signed short *__b, size_t __c) {
  2302. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2303. }
  2304. static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a,
  2305. unsigned short *__b,
  2306. size_t __c) {
  2307. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2308. }
  2309. static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a,
  2310. signed int *__b, size_t __c) {
  2311. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2312. }
  2313. static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a,
  2314. unsigned int *__b, size_t __c) {
  2315. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2316. }
  2317. static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b,
  2318. size_t __c) {
  2319. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2320. }
  2321. static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a,
  2322. signed __int128 *__b,
  2323. size_t __c) {
  2324. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2325. }
  2326. static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a,
  2327. unsigned __int128 *__b,
  2328. size_t __c) {
  2329. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2330. }
  2331. static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a,
  2332. signed long long *__b,
  2333. size_t __c) {
  2334. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2335. }
  2336. static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a,
  2337. unsigned long long *__b,
  2338. size_t __c) {
  2339. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2340. }
  2341. static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b,
  2342. size_t __c) {
  2343. return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
  2344. }
  2345. static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a,
  2346. unsigned char *__b,
  2347. size_t __c) {
  2348. #ifdef __LITTLE_ENDIAN__
  2349. vector unsigned char __mask =
  2350. (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL);
  2351. vector unsigned char __res =
  2352. __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask);
  2353. return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56));
  2354. #else
  2355. return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56));
  2356. #endif
  2357. }
  2358. #endif
  2359. #endif
  2360. /* vec_cpsgn */
  2361. #ifdef __VSX__
  2362. static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
  2363. vector float __b) {
  2364. return __builtin_vsx_xvcpsgnsp(__a, __b);
  2365. }
  2366. static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
  2367. vector double __b) {
  2368. return __builtin_vsx_xvcpsgndp(__a, __b);
  2369. }
  2370. #endif
  2371. /* vec_ctf */
  2372. #ifdef __VSX__
  2373. #define vec_ctf(__a, __b) \
  2374. _Generic((__a), vector int \
  2375. : (vector float)__builtin_altivec_vcfsx((__a), (__b)), \
  2376. vector unsigned int \
  2377. : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)), \
  2378. vector unsigned long long \
  2379. : (__builtin_convertvector((vector unsigned long long)(__a), \
  2380. vector double) * \
  2381. (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
  2382. << 52)), \
  2383. vector signed long long \
  2384. : (__builtin_convertvector((vector signed long long)(__a), \
  2385. vector double) * \
  2386. (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \
  2387. << 52)))
  2388. #else
  2389. #define vec_ctf(__a, __b) \
  2390. _Generic((__a), vector int \
  2391. : (vector float)__builtin_altivec_vcfsx((__a), (__b)), \
  2392. vector unsigned int \
  2393. : (vector float)__builtin_altivec_vcfux((vector int)(__a), (__b)))
  2394. #endif
  2395. /* vec_vcfsx */
  2396. #define vec_vcfux __builtin_altivec_vcfux
  2397. /* vec_vcfux */
  2398. #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
  2399. /* vec_cts */
  2400. #ifdef __VSX__
  2401. #define vec_cts(__a, __b) \
  2402. _Generic((__a), vector float \
  2403. : __builtin_altivec_vctsxs((__a), (__b)), vector double \
  2404. : __extension__({ \
  2405. vector double __ret = \
  2406. (__a) * \
  2407. (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \
  2408. << 52); \
  2409. __builtin_convertvector(__ret, vector signed long long); \
  2410. }))
  2411. #else
  2412. #define vec_cts __builtin_altivec_vctsxs
  2413. #endif
  2414. /* vec_vctsxs */
  2415. #define vec_vctsxs __builtin_altivec_vctsxs
  2416. /* vec_ctu */
  2417. #ifdef __VSX__
  2418. #define vec_ctu(__a, __b) \
  2419. _Generic((__a), vector float \
  2420. : __builtin_altivec_vctuxs((__a), (__b)), vector double \
  2421. : __extension__({ \
  2422. vector double __ret = \
  2423. (__a) * \
  2424. (vector double)(vector unsigned long long)((0x3ffULL + __b) \
  2425. << 52); \
  2426. __builtin_convertvector(__ret, vector unsigned long long); \
  2427. }))
  2428. #else
  2429. #define vec_ctu __builtin_altivec_vctuxs
  2430. #endif
  2431. /* vec_vctuxs */
  2432. #define vec_vctuxs __builtin_altivec_vctuxs
  2433. /* vec_signed */
  2434. static __inline__ vector signed int __ATTRS_o_ai
  2435. vec_sld(vector signed int, vector signed int, unsigned const int __c);
  2436. static __inline__ vector signed int __ATTRS_o_ai
  2437. vec_signed(vector float __a) {
  2438. return __builtin_convertvector(__a, vector signed int);
  2439. }
  2440. #ifdef __VSX__
  2441. static __inline__ vector signed long long __ATTRS_o_ai
  2442. vec_signed(vector double __a) {
  2443. return __builtin_convertvector(__a, vector signed long long);
  2444. }
  2445. static __inline__ vector signed int __attribute__((__always_inline__))
  2446. vec_signed2(vector double __a, vector double __b) {
  2447. return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
  2448. }
  2449. static __inline__ vector signed int __ATTRS_o_ai
  2450. vec_signede(vector double __a) {
  2451. #ifdef __LITTLE_ENDIAN__
  2452. vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
  2453. return vec_sld(__ret, __ret, 12);
  2454. #else
  2455. return __builtin_vsx_xvcvdpsxws(__a);
  2456. #endif
  2457. }
  2458. static __inline__ vector signed int __ATTRS_o_ai
  2459. vec_signedo(vector double __a) {
  2460. #ifdef __LITTLE_ENDIAN__
  2461. return __builtin_vsx_xvcvdpsxws(__a);
  2462. #else
  2463. vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
  2464. return vec_sld(__ret, __ret, 12);
  2465. #endif
  2466. }
  2467. #endif
  2468. /* vec_unsigned */
  2469. static __inline__ vector unsigned int __ATTRS_o_ai
  2470. vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
  2471. static __inline__ vector unsigned int __ATTRS_o_ai
  2472. vec_unsigned(vector float __a) {
  2473. return __builtin_convertvector(__a, vector unsigned int);
  2474. }
  2475. #ifdef __VSX__
  2476. static __inline__ vector unsigned long long __ATTRS_o_ai
  2477. vec_unsigned(vector double __a) {
  2478. return __builtin_convertvector(__a, vector unsigned long long);
  2479. }
  2480. static __inline__ vector unsigned int __attribute__((__always_inline__))
  2481. vec_unsigned2(vector double __a, vector double __b) {
  2482. return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
  2483. }
  2484. static __inline__ vector unsigned int __ATTRS_o_ai
  2485. vec_unsignede(vector double __a) {
  2486. #ifdef __LITTLE_ENDIAN__
  2487. vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
  2488. return vec_sld(__ret, __ret, 12);
  2489. #else
  2490. return __builtin_vsx_xvcvdpuxws(__a);
  2491. #endif
  2492. }
  2493. static __inline__ vector unsigned int __ATTRS_o_ai
  2494. vec_unsignedo(vector double __a) {
  2495. #ifdef __LITTLE_ENDIAN__
  2496. return __builtin_vsx_xvcvdpuxws(__a);
  2497. #else
  2498. vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
  2499. return vec_sld(__ret, __ret, 12);
  2500. #endif
  2501. }
  2502. #endif
  2503. /* vec_float */
  2504. static __inline__ vector float __ATTRS_o_ai
  2505. vec_sld(vector float, vector float, unsigned const int __c);
  2506. static __inline__ vector float __ATTRS_o_ai
  2507. vec_float(vector signed int __a) {
  2508. return __builtin_convertvector(__a, vector float);
  2509. }
  2510. static __inline__ vector float __ATTRS_o_ai
  2511. vec_float(vector unsigned int __a) {
  2512. return __builtin_convertvector(__a, vector float);
  2513. }
  2514. #ifdef __VSX__
  2515. static __inline__ vector float __ATTRS_o_ai
  2516. vec_float2(vector signed long long __a, vector signed long long __b) {
  2517. return (vector float) { __a[0], __a[1], __b[0], __b[1] };
  2518. }
  2519. static __inline__ vector float __ATTRS_o_ai
  2520. vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
  2521. return (vector float) { __a[0], __a[1], __b[0], __b[1] };
  2522. }
  2523. static __inline__ vector float __ATTRS_o_ai
  2524. vec_float2(vector double __a, vector double __b) {
  2525. return (vector float) { __a[0], __a[1], __b[0], __b[1] };
  2526. }
  2527. static __inline__ vector float __ATTRS_o_ai
  2528. vec_floate(vector signed long long __a) {
  2529. #ifdef __LITTLE_ENDIAN__
  2530. vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
  2531. return vec_sld(__ret, __ret, 12);
  2532. #else
  2533. return __builtin_vsx_xvcvsxdsp(__a);
  2534. #endif
  2535. }
  2536. static __inline__ vector float __ATTRS_o_ai
  2537. vec_floate(vector unsigned long long __a) {
  2538. #ifdef __LITTLE_ENDIAN__
  2539. vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
  2540. return vec_sld(__ret, __ret, 12);
  2541. #else
  2542. return __builtin_vsx_xvcvuxdsp(__a);
  2543. #endif
  2544. }
  2545. static __inline__ vector float __ATTRS_o_ai
  2546. vec_floate(vector double __a) {
  2547. #ifdef __LITTLE_ENDIAN__
  2548. vector float __ret = __builtin_vsx_xvcvdpsp(__a);
  2549. return vec_sld(__ret, __ret, 12);
  2550. #else
  2551. return __builtin_vsx_xvcvdpsp(__a);
  2552. #endif
  2553. }
  2554. static __inline__ vector float __ATTRS_o_ai
  2555. vec_floato(vector signed long long __a) {
  2556. #ifdef __LITTLE_ENDIAN__
  2557. return __builtin_vsx_xvcvsxdsp(__a);
  2558. #else
  2559. vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
  2560. return vec_sld(__ret, __ret, 12);
  2561. #endif
  2562. }
  2563. static __inline__ vector float __ATTRS_o_ai
  2564. vec_floato(vector unsigned long long __a) {
  2565. #ifdef __LITTLE_ENDIAN__
  2566. return __builtin_vsx_xvcvuxdsp(__a);
  2567. #else
  2568. vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
  2569. return vec_sld(__ret, __ret, 12);
  2570. #endif
  2571. }
  2572. static __inline__ vector float __ATTRS_o_ai
  2573. vec_floato(vector double __a) {
  2574. #ifdef __LITTLE_ENDIAN__
  2575. return __builtin_vsx_xvcvdpsp(__a);
  2576. #else
  2577. vector float __ret = __builtin_vsx_xvcvdpsp(__a);
  2578. return vec_sld(__ret, __ret, 12);
  2579. #endif
  2580. }
  2581. #endif
  2582. /* vec_double */
  2583. #ifdef __VSX__
  2584. static __inline__ vector double __ATTRS_o_ai
  2585. vec_double(vector signed long long __a) {
  2586. return __builtin_convertvector(__a, vector double);
  2587. }
  2588. static __inline__ vector double __ATTRS_o_ai
  2589. vec_double(vector unsigned long long __a) {
  2590. return __builtin_convertvector(__a, vector double);
  2591. }
  2592. static __inline__ vector double __ATTRS_o_ai
  2593. vec_doublee(vector signed int __a) {
  2594. #ifdef __LITTLE_ENDIAN__
  2595. return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
  2596. #else
  2597. return __builtin_vsx_xvcvsxwdp(__a);
  2598. #endif
  2599. }
  2600. static __inline__ vector double __ATTRS_o_ai
  2601. vec_doublee(vector unsigned int __a) {
  2602. #ifdef __LITTLE_ENDIAN__
  2603. return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
  2604. #else
  2605. return __builtin_vsx_xvcvuxwdp(__a);
  2606. #endif
  2607. }
  2608. static __inline__ vector double __ATTRS_o_ai
  2609. vec_doublee(vector float __a) {
  2610. #ifdef __LITTLE_ENDIAN__
  2611. return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
  2612. #else
  2613. return __builtin_vsx_xvcvspdp(__a);
  2614. #endif
  2615. }
  2616. static __inline__ vector double __ATTRS_o_ai
  2617. vec_doubleh(vector signed int __a) {
  2618. vector double __ret = {__a[0], __a[1]};
  2619. return __ret;
  2620. }
  2621. static __inline__ vector double __ATTRS_o_ai
  2622. vec_doubleh(vector unsigned int __a) {
  2623. vector double __ret = {__a[0], __a[1]};
  2624. return __ret;
  2625. }
  2626. static __inline__ vector double __ATTRS_o_ai
  2627. vec_doubleh(vector float __a) {
  2628. vector double __ret = {__a[0], __a[1]};
  2629. return __ret;
  2630. }
  2631. static __inline__ vector double __ATTRS_o_ai
  2632. vec_doublel(vector signed int __a) {
  2633. vector double __ret = {__a[2], __a[3]};
  2634. return __ret;
  2635. }
  2636. static __inline__ vector double __ATTRS_o_ai
  2637. vec_doublel(vector unsigned int __a) {
  2638. vector double __ret = {__a[2], __a[3]};
  2639. return __ret;
  2640. }
  2641. static __inline__ vector double __ATTRS_o_ai
  2642. vec_doublel(vector float __a) {
  2643. vector double __ret = {__a[2], __a[3]};
  2644. return __ret;
  2645. }
  2646. static __inline__ vector double __ATTRS_o_ai
  2647. vec_doubleo(vector signed int __a) {
  2648. #ifdef __LITTLE_ENDIAN__
  2649. return __builtin_vsx_xvcvsxwdp(__a);
  2650. #else
  2651. return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
  2652. #endif
  2653. }
  2654. static __inline__ vector double __ATTRS_o_ai
  2655. vec_doubleo(vector unsigned int __a) {
  2656. #ifdef __LITTLE_ENDIAN__
  2657. return __builtin_vsx_xvcvuxwdp(__a);
  2658. #else
  2659. return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
  2660. #endif
  2661. }
  2662. static __inline__ vector double __ATTRS_o_ai
  2663. vec_doubleo(vector float __a) {
  2664. #ifdef __LITTLE_ENDIAN__
  2665. return __builtin_vsx_xvcvspdp(__a);
  2666. #else
  2667. return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
  2668. #endif
  2669. }
  2670. #endif
  2671. /* vec_div */
  2672. /* Integer vector divides (vectors are scalarized, elements divided
  2673. and the vectors reassembled).
  2674. */
  2675. static __inline__ vector signed char __ATTRS_o_ai
  2676. vec_div(vector signed char __a, vector signed char __b) {
  2677. return __a / __b;
  2678. }
  2679. static __inline__ vector unsigned char __ATTRS_o_ai
  2680. vec_div(vector unsigned char __a, vector unsigned char __b) {
  2681. return __a / __b;
  2682. }
  2683. static __inline__ vector signed short __ATTRS_o_ai
  2684. vec_div(vector signed short __a, vector signed short __b) {
  2685. return __a / __b;
  2686. }
  2687. static __inline__ vector unsigned short __ATTRS_o_ai
  2688. vec_div(vector unsigned short __a, vector unsigned short __b) {
  2689. return __a / __b;
  2690. }
  2691. static __inline__ vector signed int __ATTRS_o_ai
  2692. vec_div(vector signed int __a, vector signed int __b) {
  2693. return __a / __b;
  2694. }
  2695. static __inline__ vector unsigned int __ATTRS_o_ai
  2696. vec_div(vector unsigned int __a, vector unsigned int __b) {
  2697. return __a / __b;
  2698. }
  2699. #ifdef __VSX__
  2700. static __inline__ vector signed long long __ATTRS_o_ai
  2701. vec_div(vector signed long long __a, vector signed long long __b) {
  2702. return __a / __b;
  2703. }
  2704. static __inline__ vector unsigned long long __ATTRS_o_ai
  2705. vec_div(vector unsigned long long __a, vector unsigned long long __b) {
  2706. return __a / __b;
  2707. }
  2708. static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
  2709. vector float __b) {
  2710. return __a / __b;
  2711. }
  2712. static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
  2713. vector double __b) {
  2714. return __a / __b;
  2715. }
  2716. #endif
  2717. /* vec_dss */
  2718. static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) {
  2719. __builtin_altivec_dss(__a);
  2720. }
  2721. /* vec_dssall */
  2722. static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
  2723. __builtin_altivec_dssall();
  2724. }
  2725. /* vec_dst */
  2726. #define vec_dst(__PTR, __CW, __STR) \
  2727. __extension__( \
  2728. { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); })
  2729. /* vec_dstst */
  2730. #define vec_dstst(__PTR, __CW, __STR) \
  2731. __extension__( \
  2732. { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); })
  2733. /* vec_dststt */
  2734. #define vec_dststt(__PTR, __CW, __STR) \
  2735. __extension__( \
  2736. { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); })
  2737. /* vec_dstt */
  2738. #define vec_dstt(__PTR, __CW, __STR) \
  2739. __extension__( \
  2740. { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); })
  2741. /* vec_eqv */
  2742. #ifdef __POWER8_VECTOR__
  2743. static __inline__ vector signed char __ATTRS_o_ai
  2744. vec_eqv(vector signed char __a, vector signed char __b) {
  2745. return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2746. (vector unsigned int)__b);
  2747. }
  2748. static __inline__ vector unsigned char __ATTRS_o_ai
  2749. vec_eqv(vector unsigned char __a, vector unsigned char __b) {
  2750. return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2751. (vector unsigned int)__b);
  2752. }
  2753. static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
  2754. vector bool char __b) {
  2755. return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2756. (vector unsigned int)__b);
  2757. }
  2758. static __inline__ vector signed short __ATTRS_o_ai
  2759. vec_eqv(vector signed short __a, vector signed short __b) {
  2760. return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2761. (vector unsigned int)__b);
  2762. }
  2763. static __inline__ vector unsigned short __ATTRS_o_ai
  2764. vec_eqv(vector unsigned short __a, vector unsigned short __b) {
  2765. return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2766. (vector unsigned int)__b);
  2767. }
  2768. static __inline__ vector bool short __ATTRS_o_ai
  2769. vec_eqv(vector bool short __a, vector bool short __b) {
  2770. return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2771. (vector unsigned int)__b);
  2772. }
  2773. static __inline__ vector signed int __ATTRS_o_ai
  2774. vec_eqv(vector signed int __a, vector signed int __b) {
  2775. return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2776. (vector unsigned int)__b);
  2777. }
  2778. static __inline__ vector unsigned int __ATTRS_o_ai
  2779. vec_eqv(vector unsigned int __a, vector unsigned int __b) {
  2780. return __builtin_vsx_xxleqv(__a, __b);
  2781. }
  2782. static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
  2783. vector bool int __b) {
  2784. return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2785. (vector unsigned int)__b);
  2786. }
  2787. static __inline__ vector signed long long __ATTRS_o_ai
  2788. vec_eqv(vector signed long long __a, vector signed long long __b) {
  2789. return (vector signed long long)__builtin_vsx_xxleqv(
  2790. (vector unsigned int)__a, (vector unsigned int)__b);
  2791. }
  2792. static __inline__ vector unsigned long long __ATTRS_o_ai
  2793. vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
  2794. return (vector unsigned long long)__builtin_vsx_xxleqv(
  2795. (vector unsigned int)__a, (vector unsigned int)__b);
  2796. }
  2797. static __inline__ vector bool long long __ATTRS_o_ai
  2798. vec_eqv(vector bool long long __a, vector bool long long __b) {
  2799. return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2800. (vector unsigned int)__b);
  2801. }
  2802. static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
  2803. vector float __b) {
  2804. return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2805. (vector unsigned int)__b);
  2806. }
  2807. static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
  2808. vector double __b) {
  2809. return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
  2810. (vector unsigned int)__b);
  2811. }
  2812. #endif
  2813. /* vec_expte */
  2814. static __inline__ vector float __attribute__((__always_inline__))
  2815. vec_expte(vector float __a) {
  2816. return __builtin_altivec_vexptefp(__a);
  2817. }
  2818. /* vec_vexptefp */
  2819. static __inline__ vector float __attribute__((__always_inline__))
  2820. vec_vexptefp(vector float __a) {
  2821. return __builtin_altivec_vexptefp(__a);
  2822. }
  2823. /* vec_floor */
  2824. static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
  2825. #ifdef __VSX__
  2826. return __builtin_vsx_xvrspim(__a);
  2827. #else
  2828. return __builtin_altivec_vrfim(__a);
  2829. #endif
  2830. }
  2831. #ifdef __VSX__
  2832. static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
  2833. return __builtin_vsx_xvrdpim(__a);
  2834. }
  2835. #endif
  2836. /* vec_vrfim */
  2837. static __inline__ vector float __attribute__((__always_inline__))
  2838. vec_vrfim(vector float __a) {
  2839. return __builtin_altivec_vrfim(__a);
  2840. }
  2841. /* vec_ld */
  2842. static __inline__ vector signed char __ATTRS_o_ai
  2843. vec_ld(int __a, const vector signed char *__b) {
  2844. return (vector signed char)__builtin_altivec_lvx(__a, __b);
  2845. }
  2846. static __inline__ vector signed char __ATTRS_o_ai
  2847. vec_ld(int __a, const signed char *__b) {
  2848. return (vector signed char)__builtin_altivec_lvx(__a, __b);
  2849. }
  2850. static __inline__ vector unsigned char __ATTRS_o_ai
  2851. vec_ld(int __a, const vector unsigned char *__b) {
  2852. return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
  2853. }
  2854. static __inline__ vector unsigned char __ATTRS_o_ai
  2855. vec_ld(int __a, const unsigned char *__b) {
  2856. return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
  2857. }
  2858. static __inline__ vector bool char __ATTRS_o_ai
  2859. vec_ld(int __a, const vector bool char *__b) {
  2860. return (vector bool char)__builtin_altivec_lvx(__a, __b);
  2861. }
  2862. static __inline__ vector short __ATTRS_o_ai vec_ld(int __a,
  2863. const vector short *__b) {
  2864. return (vector short)__builtin_altivec_lvx(__a, __b);
  2865. }
  2866. static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) {
  2867. return (vector short)__builtin_altivec_lvx(__a, __b);
  2868. }
  2869. static __inline__ vector unsigned short __ATTRS_o_ai
  2870. vec_ld(int __a, const vector unsigned short *__b) {
  2871. return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
  2872. }
  2873. static __inline__ vector unsigned short __ATTRS_o_ai
  2874. vec_ld(int __a, const unsigned short *__b) {
  2875. return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
  2876. }
  2877. static __inline__ vector bool short __ATTRS_o_ai
  2878. vec_ld(int __a, const vector bool short *__b) {
  2879. return (vector bool short)__builtin_altivec_lvx(__a, __b);
  2880. }
  2881. static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a,
  2882. const vector pixel *__b) {
  2883. return (vector pixel)__builtin_altivec_lvx(__a, __b);
  2884. }
  2885. static __inline__ vector int __ATTRS_o_ai vec_ld(int __a,
  2886. const vector int *__b) {
  2887. return (vector int)__builtin_altivec_lvx(__a, __b);
  2888. }
  2889. static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) {
  2890. return (vector int)__builtin_altivec_lvx(__a, __b);
  2891. }
  2892. static __inline__ vector unsigned int __ATTRS_o_ai
  2893. vec_ld(int __a, const vector unsigned int *__b) {
  2894. return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
  2895. }
  2896. static __inline__ vector unsigned int __ATTRS_o_ai
  2897. vec_ld(int __a, const unsigned int *__b) {
  2898. return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
  2899. }
  2900. static __inline__ vector bool int __ATTRS_o_ai
  2901. vec_ld(int __a, const vector bool int *__b) {
  2902. return (vector bool int)__builtin_altivec_lvx(__a, __b);
  2903. }
  2904. static __inline__ vector float __ATTRS_o_ai vec_ld(int __a,
  2905. const vector float *__b) {
  2906. return (vector float)__builtin_altivec_lvx(__a, __b);
  2907. }
  2908. static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) {
  2909. return (vector float)__builtin_altivec_lvx(__a, __b);
  2910. }
  2911. /* vec_lvx */
  2912. static __inline__ vector signed char __ATTRS_o_ai
  2913. vec_lvx(int __a, const vector signed char *__b) {
  2914. return (vector signed char)__builtin_altivec_lvx(__a, __b);
  2915. }
  2916. static __inline__ vector signed char __ATTRS_o_ai
  2917. vec_lvx(int __a, const signed char *__b) {
  2918. return (vector signed char)__builtin_altivec_lvx(__a, __b);
  2919. }
  2920. static __inline__ vector unsigned char __ATTRS_o_ai
  2921. vec_lvx(int __a, const vector unsigned char *__b) {
  2922. return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
  2923. }
  2924. static __inline__ vector unsigned char __ATTRS_o_ai
  2925. vec_lvx(int __a, const unsigned char *__b) {
  2926. return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
  2927. }
  2928. static __inline__ vector bool char __ATTRS_o_ai
  2929. vec_lvx(int __a, const vector bool char *__b) {
  2930. return (vector bool char)__builtin_altivec_lvx(__a, __b);
  2931. }
  2932. static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a,
  2933. const vector short *__b) {
  2934. return (vector short)__builtin_altivec_lvx(__a, __b);
  2935. }
  2936. static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) {
  2937. return (vector short)__builtin_altivec_lvx(__a, __b);
  2938. }
  2939. static __inline__ vector unsigned short __ATTRS_o_ai
  2940. vec_lvx(int __a, const vector unsigned short *__b) {
  2941. return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
  2942. }
  2943. static __inline__ vector unsigned short __ATTRS_o_ai
  2944. vec_lvx(int __a, const unsigned short *__b) {
  2945. return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
  2946. }
  2947. static __inline__ vector bool short __ATTRS_o_ai
  2948. vec_lvx(int __a, const vector bool short *__b) {
  2949. return (vector bool short)__builtin_altivec_lvx(__a, __b);
  2950. }
  2951. static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a,
  2952. const vector pixel *__b) {
  2953. return (vector pixel)__builtin_altivec_lvx(__a, __b);
  2954. }
  2955. static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a,
  2956. const vector int *__b) {
  2957. return (vector int)__builtin_altivec_lvx(__a, __b);
  2958. }
  2959. static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) {
  2960. return (vector int)__builtin_altivec_lvx(__a, __b);
  2961. }
  2962. static __inline__ vector unsigned int __ATTRS_o_ai
  2963. vec_lvx(int __a, const vector unsigned int *__b) {
  2964. return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
  2965. }
  2966. static __inline__ vector unsigned int __ATTRS_o_ai
  2967. vec_lvx(int __a, const unsigned int *__b) {
  2968. return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
  2969. }
  2970. static __inline__ vector bool int __ATTRS_o_ai
  2971. vec_lvx(int __a, const vector bool int *__b) {
  2972. return (vector bool int)__builtin_altivec_lvx(__a, __b);
  2973. }
  2974. static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a,
  2975. const vector float *__b) {
  2976. return (vector float)__builtin_altivec_lvx(__a, __b);
  2977. }
  2978. static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) {
  2979. return (vector float)__builtin_altivec_lvx(__a, __b);
  2980. }
  2981. /* vec_lde */
  2982. static __inline__ vector signed char __ATTRS_o_ai
  2983. vec_lde(int __a, const signed char *__b) {
  2984. return (vector signed char)__builtin_altivec_lvebx(__a, __b);
  2985. }
  2986. static __inline__ vector unsigned char __ATTRS_o_ai
  2987. vec_lde(int __a, const unsigned char *__b) {
  2988. return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
  2989. }
  2990. static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) {
  2991. return (vector short)__builtin_altivec_lvehx(__a, __b);
  2992. }
  2993. static __inline__ vector unsigned short __ATTRS_o_ai
  2994. vec_lde(int __a, const unsigned short *__b) {
  2995. return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
  2996. }
  2997. static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) {
  2998. return (vector int)__builtin_altivec_lvewx(__a, __b);
  2999. }
  3000. static __inline__ vector unsigned int __ATTRS_o_ai
  3001. vec_lde(int __a, const unsigned int *__b) {
  3002. return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
  3003. }
  3004. static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) {
  3005. return (vector float)__builtin_altivec_lvewx(__a, __b);
  3006. }
  3007. /* vec_lvebx */
  3008. static __inline__ vector signed char __ATTRS_o_ai
  3009. vec_lvebx(int __a, const signed char *__b) {
  3010. return (vector signed char)__builtin_altivec_lvebx(__a, __b);
  3011. }
  3012. static __inline__ vector unsigned char __ATTRS_o_ai
  3013. vec_lvebx(int __a, const unsigned char *__b) {
  3014. return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
  3015. }
  3016. /* vec_lvehx */
  3017. static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a,
  3018. const short *__b) {
  3019. return (vector short)__builtin_altivec_lvehx(__a, __b);
  3020. }
  3021. static __inline__ vector unsigned short __ATTRS_o_ai
  3022. vec_lvehx(int __a, const unsigned short *__b) {
  3023. return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
  3024. }
  3025. /* vec_lvewx */
  3026. static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) {
  3027. return (vector int)__builtin_altivec_lvewx(__a, __b);
  3028. }
  3029. static __inline__ vector unsigned int __ATTRS_o_ai
  3030. vec_lvewx(int __a, const unsigned int *__b) {
  3031. return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
  3032. }
  3033. static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a,
  3034. const float *__b) {
  3035. return (vector float)__builtin_altivec_lvewx(__a, __b);
  3036. }
  3037. /* vec_ldl */
  3038. static __inline__ vector signed char __ATTRS_o_ai
  3039. vec_ldl(int __a, const vector signed char *__b) {
  3040. return (vector signed char)__builtin_altivec_lvxl(__a, __b);
  3041. }
  3042. static __inline__ vector signed char __ATTRS_o_ai
  3043. vec_ldl(int __a, const signed char *__b) {
  3044. return (vector signed char)__builtin_altivec_lvxl(__a, __b);
  3045. }
  3046. static __inline__ vector unsigned char __ATTRS_o_ai
  3047. vec_ldl(int __a, const vector unsigned char *__b) {
  3048. return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
  3049. }
  3050. static __inline__ vector unsigned char __ATTRS_o_ai
  3051. vec_ldl(int __a, const unsigned char *__b) {
  3052. return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
  3053. }
  3054. static __inline__ vector bool char __ATTRS_o_ai
  3055. vec_ldl(int __a, const vector bool char *__b) {
  3056. return (vector bool char)__builtin_altivec_lvxl(__a, __b);
  3057. }
  3058. static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a,
  3059. const vector short *__b) {
  3060. return (vector short)__builtin_altivec_lvxl(__a, __b);
  3061. }
  3062. static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) {
  3063. return (vector short)__builtin_altivec_lvxl(__a, __b);
  3064. }
  3065. static __inline__ vector unsigned short __ATTRS_o_ai
  3066. vec_ldl(int __a, const vector unsigned short *__b) {
  3067. return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
  3068. }
  3069. static __inline__ vector unsigned short __ATTRS_o_ai
  3070. vec_ldl(int __a, const unsigned short *__b) {
  3071. return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
  3072. }
  3073. static __inline__ vector bool short __ATTRS_o_ai
  3074. vec_ldl(int __a, const vector bool short *__b) {
  3075. return (vector bool short)__builtin_altivec_lvxl(__a, __b);
  3076. }
  3077. static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a,
  3078. const vector pixel *__b) {
  3079. return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
  3080. }
  3081. static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a,
  3082. const vector int *__b) {
  3083. return (vector int)__builtin_altivec_lvxl(__a, __b);
  3084. }
  3085. static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) {
  3086. return (vector int)__builtin_altivec_lvxl(__a, __b);
  3087. }
  3088. static __inline__ vector unsigned int __ATTRS_o_ai
  3089. vec_ldl(int __a, const vector unsigned int *__b) {
  3090. return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
  3091. }
  3092. static __inline__ vector unsigned int __ATTRS_o_ai
  3093. vec_ldl(int __a, const unsigned int *__b) {
  3094. return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
  3095. }
  3096. static __inline__ vector bool int __ATTRS_o_ai
  3097. vec_ldl(int __a, const vector bool int *__b) {
  3098. return (vector bool int)__builtin_altivec_lvxl(__a, __b);
  3099. }
  3100. static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a,
  3101. const vector float *__b) {
  3102. return (vector float)__builtin_altivec_lvxl(__a, __b);
  3103. }
  3104. static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) {
  3105. return (vector float)__builtin_altivec_lvxl(__a, __b);
  3106. }
  3107. /* vec_lvxl */
  3108. static __inline__ vector signed char __ATTRS_o_ai
  3109. vec_lvxl(int __a, const vector signed char *__b) {
  3110. return (vector signed char)__builtin_altivec_lvxl(__a, __b);
  3111. }
  3112. static __inline__ vector signed char __ATTRS_o_ai
  3113. vec_lvxl(int __a, const signed char *__b) {
  3114. return (vector signed char)__builtin_altivec_lvxl(__a, __b);
  3115. }
  3116. static __inline__ vector unsigned char __ATTRS_o_ai
  3117. vec_lvxl(int __a, const vector unsigned char *__b) {
  3118. return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
  3119. }
  3120. static __inline__ vector unsigned char __ATTRS_o_ai
  3121. vec_lvxl(int __a, const unsigned char *__b) {
  3122. return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
  3123. }
  3124. static __inline__ vector bool char __ATTRS_o_ai
  3125. vec_lvxl(int __a, const vector bool char *__b) {
  3126. return (vector bool char)__builtin_altivec_lvxl(__a, __b);
  3127. }
  3128. static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
  3129. const vector short *__b) {
  3130. return (vector short)__builtin_altivec_lvxl(__a, __b);
  3131. }
  3132. static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a,
  3133. const short *__b) {
  3134. return (vector short)__builtin_altivec_lvxl(__a, __b);
  3135. }
  3136. static __inline__ vector unsigned short __ATTRS_o_ai
  3137. vec_lvxl(int __a, const vector unsigned short *__b) {
  3138. return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
  3139. }
  3140. static __inline__ vector unsigned short __ATTRS_o_ai
  3141. vec_lvxl(int __a, const unsigned short *__b) {
  3142. return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
  3143. }
  3144. static __inline__ vector bool short __ATTRS_o_ai
  3145. vec_lvxl(int __a, const vector bool short *__b) {
  3146. return (vector bool short)__builtin_altivec_lvxl(__a, __b);
  3147. }
  3148. static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a,
  3149. const vector pixel *__b) {
  3150. return (vector pixel)__builtin_altivec_lvxl(__a, __b);
  3151. }
  3152. static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a,
  3153. const vector int *__b) {
  3154. return (vector int)__builtin_altivec_lvxl(__a, __b);
  3155. }
  3156. static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) {
  3157. return (vector int)__builtin_altivec_lvxl(__a, __b);
  3158. }
  3159. static __inline__ vector unsigned int __ATTRS_o_ai
  3160. vec_lvxl(int __a, const vector unsigned int *__b) {
  3161. return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
  3162. }
  3163. static __inline__ vector unsigned int __ATTRS_o_ai
  3164. vec_lvxl(int __a, const unsigned int *__b) {
  3165. return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
  3166. }
  3167. static __inline__ vector bool int __ATTRS_o_ai
  3168. vec_lvxl(int __a, const vector bool int *__b) {
  3169. return (vector bool int)__builtin_altivec_lvxl(__a, __b);
  3170. }
  3171. static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
  3172. const vector float *__b) {
  3173. return (vector float)__builtin_altivec_lvxl(__a, __b);
  3174. }
  3175. static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a,
  3176. const float *__b) {
  3177. return (vector float)__builtin_altivec_lvxl(__a, __b);
  3178. }
  3179. /* vec_loge */
  3180. static __inline__ vector float __attribute__((__always_inline__))
  3181. vec_loge(vector float __a) {
  3182. return __builtin_altivec_vlogefp(__a);
  3183. }
  3184. /* vec_vlogefp */
  3185. static __inline__ vector float __attribute__((__always_inline__))
  3186. vec_vlogefp(vector float __a) {
  3187. return __builtin_altivec_vlogefp(__a);
  3188. }
  3189. /* vec_lvsl */
  3190. #ifdef __LITTLE_ENDIAN__
  3191. static __inline__ vector unsigned char __ATTRS_o_ai
  3192. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3193. loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
  3194. vector unsigned char mask =
  3195. (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3196. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3197. 7, 6, 5, 4, 3, 2, 1, 0};
  3198. return vec_perm(mask, mask, reverse);
  3199. }
  3200. #else
  3201. static __inline__ vector unsigned char __ATTRS_o_ai
  3202. vec_lvsl(int __a, const signed char *__b) {
  3203. return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3204. }
  3205. #endif
  3206. #ifdef __LITTLE_ENDIAN__
  3207. static __inline__ vector unsigned char __ATTRS_o_ai
  3208. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3209. loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
  3210. vector unsigned char mask =
  3211. (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3212. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3213. 7, 6, 5, 4, 3, 2, 1, 0};
  3214. return vec_perm(mask, mask, reverse);
  3215. }
  3216. #else
  3217. static __inline__ vector unsigned char __ATTRS_o_ai
  3218. vec_lvsl(int __a, const unsigned char *__b) {
  3219. return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3220. }
  3221. #endif
  3222. #ifdef __LITTLE_ENDIAN__
  3223. static __inline__ vector unsigned char __ATTRS_o_ai
  3224. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3225. loads/stores"))) vec_lvsl(int __a, const short *__b) {
  3226. vector unsigned char mask =
  3227. (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3228. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3229. 7, 6, 5, 4, 3, 2, 1, 0};
  3230. return vec_perm(mask, mask, reverse);
  3231. }
  3232. #else
  3233. static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
  3234. const short *__b) {
  3235. return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3236. }
  3237. #endif
  3238. #ifdef __LITTLE_ENDIAN__
  3239. static __inline__ vector unsigned char __ATTRS_o_ai
  3240. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3241. loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
  3242. vector unsigned char mask =
  3243. (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3244. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3245. 7, 6, 5, 4, 3, 2, 1, 0};
  3246. return vec_perm(mask, mask, reverse);
  3247. }
  3248. #else
  3249. static __inline__ vector unsigned char __ATTRS_o_ai
  3250. vec_lvsl(int __a, const unsigned short *__b) {
  3251. return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3252. }
  3253. #endif
  3254. #ifdef __LITTLE_ENDIAN__
  3255. static __inline__ vector unsigned char __ATTRS_o_ai
  3256. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3257. loads/stores"))) vec_lvsl(int __a, const int *__b) {
  3258. vector unsigned char mask =
  3259. (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3260. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3261. 7, 6, 5, 4, 3, 2, 1, 0};
  3262. return vec_perm(mask, mask, reverse);
  3263. }
  3264. #else
  3265. static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
  3266. const int *__b) {
  3267. return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3268. }
  3269. #endif
  3270. #ifdef __LITTLE_ENDIAN__
  3271. static __inline__ vector unsigned char __ATTRS_o_ai
  3272. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3273. loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
  3274. vector unsigned char mask =
  3275. (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3276. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3277. 7, 6, 5, 4, 3, 2, 1, 0};
  3278. return vec_perm(mask, mask, reverse);
  3279. }
  3280. #else
  3281. static __inline__ vector unsigned char __ATTRS_o_ai
  3282. vec_lvsl(int __a, const unsigned int *__b) {
  3283. return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3284. }
  3285. #endif
  3286. #ifdef __LITTLE_ENDIAN__
  3287. static __inline__ vector unsigned char __ATTRS_o_ai
  3288. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3289. loads/stores"))) vec_lvsl(int __a, const float *__b) {
  3290. vector unsigned char mask =
  3291. (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3292. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3293. 7, 6, 5, 4, 3, 2, 1, 0};
  3294. return vec_perm(mask, mask, reverse);
  3295. }
  3296. #else
  3297. static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
  3298. const float *__b) {
  3299. return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
  3300. }
  3301. #endif
  3302. /* vec_lvsr */
  3303. #ifdef __LITTLE_ENDIAN__
  3304. static __inline__ vector unsigned char __ATTRS_o_ai
  3305. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3306. loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
  3307. vector unsigned char mask =
  3308. (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3309. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3310. 7, 6, 5, 4, 3, 2, 1, 0};
  3311. return vec_perm(mask, mask, reverse);
  3312. }
  3313. #else
  3314. static __inline__ vector unsigned char __ATTRS_o_ai
  3315. vec_lvsr(int __a, const signed char *__b) {
  3316. return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3317. }
  3318. #endif
  3319. #ifdef __LITTLE_ENDIAN__
  3320. static __inline__ vector unsigned char __ATTRS_o_ai
  3321. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3322. loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
  3323. vector unsigned char mask =
  3324. (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3325. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3326. 7, 6, 5, 4, 3, 2, 1, 0};
  3327. return vec_perm(mask, mask, reverse);
  3328. }
  3329. #else
  3330. static __inline__ vector unsigned char __ATTRS_o_ai
  3331. vec_lvsr(int __a, const unsigned char *__b) {
  3332. return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3333. }
  3334. #endif
  3335. #ifdef __LITTLE_ENDIAN__
  3336. static __inline__ vector unsigned char __ATTRS_o_ai
  3337. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3338. loads/stores"))) vec_lvsr(int __a, const short *__b) {
  3339. vector unsigned char mask =
  3340. (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3341. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3342. 7, 6, 5, 4, 3, 2, 1, 0};
  3343. return vec_perm(mask, mask, reverse);
  3344. }
  3345. #else
  3346. static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
  3347. const short *__b) {
  3348. return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3349. }
  3350. #endif
  3351. #ifdef __LITTLE_ENDIAN__
  3352. static __inline__ vector unsigned char __ATTRS_o_ai
  3353. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3354. loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
  3355. vector unsigned char mask =
  3356. (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3357. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3358. 7, 6, 5, 4, 3, 2, 1, 0};
  3359. return vec_perm(mask, mask, reverse);
  3360. }
  3361. #else
  3362. static __inline__ vector unsigned char __ATTRS_o_ai
  3363. vec_lvsr(int __a, const unsigned short *__b) {
  3364. return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3365. }
  3366. #endif
  3367. #ifdef __LITTLE_ENDIAN__
  3368. static __inline__ vector unsigned char __ATTRS_o_ai
  3369. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3370. loads/stores"))) vec_lvsr(int __a, const int *__b) {
  3371. vector unsigned char mask =
  3372. (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3373. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3374. 7, 6, 5, 4, 3, 2, 1, 0};
  3375. return vec_perm(mask, mask, reverse);
  3376. }
  3377. #else
  3378. static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
  3379. const int *__b) {
  3380. return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3381. }
  3382. #endif
  3383. #ifdef __LITTLE_ENDIAN__
  3384. static __inline__ vector unsigned char __ATTRS_o_ai
  3385. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3386. loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
  3387. vector unsigned char mask =
  3388. (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3389. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3390. 7, 6, 5, 4, 3, 2, 1, 0};
  3391. return vec_perm(mask, mask, reverse);
  3392. }
  3393. #else
  3394. static __inline__ vector unsigned char __ATTRS_o_ai
  3395. vec_lvsr(int __a, const unsigned int *__b) {
  3396. return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3397. }
  3398. #endif
  3399. #ifdef __LITTLE_ENDIAN__
  3400. static __inline__ vector unsigned char __ATTRS_o_ai
  3401. __attribute__((__deprecated__("use assignment for unaligned little endian \
  3402. loads/stores"))) vec_lvsr(int __a, const float *__b) {
  3403. vector unsigned char mask =
  3404. (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3405. vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
  3406. 7, 6, 5, 4, 3, 2, 1, 0};
  3407. return vec_perm(mask, mask, reverse);
  3408. }
  3409. #else
  3410. static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
  3411. const float *__b) {
  3412. return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
  3413. }
  3414. #endif
  3415. /* vec_madd */
  3416. static __inline__ vector signed short __ATTRS_o_ai
  3417. vec_mladd(vector signed short, vector signed short, vector signed short);
  3418. static __inline__ vector signed short __ATTRS_o_ai
  3419. vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
  3420. static __inline__ vector signed short __ATTRS_o_ai
  3421. vec_mladd(vector unsigned short, vector signed short, vector signed short);
  3422. static __inline__ vector unsigned short __ATTRS_o_ai
  3423. vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
  3424. static __inline__ vector signed short __ATTRS_o_ai vec_madd(
  3425. vector signed short __a, vector signed short __b, vector signed short __c) {
  3426. return vec_mladd(__a, __b, __c);
  3427. }
  3428. static __inline__ vector signed short __ATTRS_o_ai
  3429. vec_madd(vector signed short __a, vector unsigned short __b,
  3430. vector unsigned short __c) {
  3431. return vec_mladd(__a, __b, __c);
  3432. }
  3433. static __inline__ vector signed short __ATTRS_o_ai
  3434. vec_madd(vector unsigned short __a, vector signed short __b,
  3435. vector signed short __c) {
  3436. return vec_mladd(__a, __b, __c);
  3437. }
  3438. static __inline__ vector unsigned short __ATTRS_o_ai
  3439. vec_madd(vector unsigned short __a, vector unsigned short __b,
  3440. vector unsigned short __c) {
  3441. return vec_mladd(__a, __b, __c);
  3442. }
  3443. static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
  3444. vector float __b,
  3445. vector float __c) {
  3446. #ifdef __VSX__
  3447. return __builtin_vsx_xvmaddasp(__a, __b, __c);
  3448. #else
  3449. return __builtin_altivec_vmaddfp(__a, __b, __c);
  3450. #endif
  3451. }
  3452. #ifdef __VSX__
  3453. static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
  3454. vector double __b,
  3455. vector double __c) {
  3456. return __builtin_vsx_xvmaddadp(__a, __b, __c);
  3457. }
  3458. #endif
  3459. /* vec_vmaddfp */
  3460. static __inline__ vector float __attribute__((__always_inline__))
  3461. vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
  3462. return __builtin_altivec_vmaddfp(__a, __b, __c);
  3463. }
  3464. /* vec_madds */
  3465. static __inline__ vector signed short __attribute__((__always_inline__))
  3466. vec_madds(vector signed short __a, vector signed short __b,
  3467. vector signed short __c) {
  3468. return __builtin_altivec_vmhaddshs(__a, __b, __c);
  3469. }
  3470. /* vec_vmhaddshs */
  3471. static __inline__ vector signed short __attribute__((__always_inline__))
  3472. vec_vmhaddshs(vector signed short __a, vector signed short __b,
  3473. vector signed short __c) {
  3474. return __builtin_altivec_vmhaddshs(__a, __b, __c);
  3475. }
  3476. /* vec_msub */
  3477. #ifdef __VSX__
  3478. static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
  3479. vector float __b,
  3480. vector float __c) {
  3481. return __builtin_vsx_xvmsubasp(__a, __b, __c);
  3482. }
  3483. static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
  3484. vector double __b,
  3485. vector double __c) {
  3486. return __builtin_vsx_xvmsubadp(__a, __b, __c);
  3487. }
  3488. #endif
  3489. /* vec_max */
  3490. static __inline__ vector signed char __ATTRS_o_ai
  3491. vec_max(vector signed char __a, vector signed char __b) {
  3492. return __builtin_altivec_vmaxsb(__a, __b);
  3493. }
  3494. static __inline__ vector signed char __ATTRS_o_ai
  3495. vec_max(vector bool char __a, vector signed char __b) {
  3496. return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
  3497. }
  3498. static __inline__ vector signed char __ATTRS_o_ai
  3499. vec_max(vector signed char __a, vector bool char __b) {
  3500. return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
  3501. }
  3502. static __inline__ vector unsigned char __ATTRS_o_ai
  3503. vec_max(vector unsigned char __a, vector unsigned char __b) {
  3504. return __builtin_altivec_vmaxub(__a, __b);
  3505. }
  3506. static __inline__ vector unsigned char __ATTRS_o_ai
  3507. vec_max(vector bool char __a, vector unsigned char __b) {
  3508. return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
  3509. }
  3510. static __inline__ vector unsigned char __ATTRS_o_ai
  3511. vec_max(vector unsigned char __a, vector bool char __b) {
  3512. return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
  3513. }
  3514. static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
  3515. vector short __b) {
  3516. return __builtin_altivec_vmaxsh(__a, __b);
  3517. }
  3518. static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
  3519. vector short __b) {
  3520. return __builtin_altivec_vmaxsh((vector short)__a, __b);
  3521. }
  3522. static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
  3523. vector bool short __b) {
  3524. return __builtin_altivec_vmaxsh(__a, (vector short)__b);
  3525. }
  3526. static __inline__ vector unsigned short __ATTRS_o_ai
  3527. vec_max(vector unsigned short __a, vector unsigned short __b) {
  3528. return __builtin_altivec_vmaxuh(__a, __b);
  3529. }
  3530. static __inline__ vector unsigned short __ATTRS_o_ai
  3531. vec_max(vector bool short __a, vector unsigned short __b) {
  3532. return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
  3533. }
  3534. static __inline__ vector unsigned short __ATTRS_o_ai
  3535. vec_max(vector unsigned short __a, vector bool short __b) {
  3536. return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
  3537. }
  3538. static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
  3539. vector int __b) {
  3540. return __builtin_altivec_vmaxsw(__a, __b);
  3541. }
  3542. static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
  3543. vector int __b) {
  3544. return __builtin_altivec_vmaxsw((vector int)__a, __b);
  3545. }
  3546. static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
  3547. vector bool int __b) {
  3548. return __builtin_altivec_vmaxsw(__a, (vector int)__b);
  3549. }
  3550. static __inline__ vector unsigned int __ATTRS_o_ai
  3551. vec_max(vector unsigned int __a, vector unsigned int __b) {
  3552. return __builtin_altivec_vmaxuw(__a, __b);
  3553. }
  3554. static __inline__ vector unsigned int __ATTRS_o_ai
  3555. vec_max(vector bool int __a, vector unsigned int __b) {
  3556. return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
  3557. }
  3558. static __inline__ vector unsigned int __ATTRS_o_ai
  3559. vec_max(vector unsigned int __a, vector bool int __b) {
  3560. return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
  3561. }
  3562. #ifdef __POWER8_VECTOR__
  3563. static __inline__ vector signed long long __ATTRS_o_ai
  3564. vec_max(vector signed long long __a, vector signed long long __b) {
  3565. return __builtin_altivec_vmaxsd(__a, __b);
  3566. }
  3567. static __inline__ vector signed long long __ATTRS_o_ai
  3568. vec_max(vector bool long long __a, vector signed long long __b) {
  3569. return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
  3570. }
  3571. static __inline__ vector signed long long __ATTRS_o_ai
  3572. vec_max(vector signed long long __a, vector bool long long __b) {
  3573. return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
  3574. }
  3575. static __inline__ vector unsigned long long __ATTRS_o_ai
  3576. vec_max(vector unsigned long long __a, vector unsigned long long __b) {
  3577. return __builtin_altivec_vmaxud(__a, __b);
  3578. }
  3579. static __inline__ vector unsigned long long __ATTRS_o_ai
  3580. vec_max(vector bool long long __a, vector unsigned long long __b) {
  3581. return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
  3582. }
  3583. static __inline__ vector unsigned long long __ATTRS_o_ai
  3584. vec_max(vector unsigned long long __a, vector bool long long __b) {
  3585. return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
  3586. }
  3587. #endif
  3588. static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
  3589. vector float __b) {
  3590. #ifdef __VSX__
  3591. return __builtin_vsx_xvmaxsp(__a, __b);
  3592. #else
  3593. return __builtin_altivec_vmaxfp(__a, __b);
  3594. #endif
  3595. }
  3596. #ifdef __VSX__
  3597. static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
  3598. vector double __b) {
  3599. return __builtin_vsx_xvmaxdp(__a, __b);
  3600. }
  3601. #endif
  3602. /* vec_vmaxsb */
  3603. static __inline__ vector signed char __ATTRS_o_ai
  3604. vec_vmaxsb(vector signed char __a, vector signed char __b) {
  3605. return __builtin_altivec_vmaxsb(__a, __b);
  3606. }
  3607. static __inline__ vector signed char __ATTRS_o_ai
  3608. vec_vmaxsb(vector bool char __a, vector signed char __b) {
  3609. return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
  3610. }
  3611. static __inline__ vector signed char __ATTRS_o_ai
  3612. vec_vmaxsb(vector signed char __a, vector bool char __b) {
  3613. return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
  3614. }
  3615. /* vec_vmaxub */
  3616. static __inline__ vector unsigned char __ATTRS_o_ai
  3617. vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
  3618. return __builtin_altivec_vmaxub(__a, __b);
  3619. }
  3620. static __inline__ vector unsigned char __ATTRS_o_ai
  3621. vec_vmaxub(vector bool char __a, vector unsigned char __b) {
  3622. return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
  3623. }
  3624. static __inline__ vector unsigned char __ATTRS_o_ai
  3625. vec_vmaxub(vector unsigned char __a, vector bool char __b) {
  3626. return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
  3627. }
  3628. /* vec_vmaxsh */
  3629. static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
  3630. vector short __b) {
  3631. return __builtin_altivec_vmaxsh(__a, __b);
  3632. }
  3633. static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
  3634. vector short __b) {
  3635. return __builtin_altivec_vmaxsh((vector short)__a, __b);
  3636. }
  3637. static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
  3638. vector bool short __b) {
  3639. return __builtin_altivec_vmaxsh(__a, (vector short)__b);
  3640. }
  3641. /* vec_vmaxuh */
  3642. static __inline__ vector unsigned short __ATTRS_o_ai
  3643. vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
  3644. return __builtin_altivec_vmaxuh(__a, __b);
  3645. }
  3646. static __inline__ vector unsigned short __ATTRS_o_ai
  3647. vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
  3648. return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
  3649. }
  3650. static __inline__ vector unsigned short __ATTRS_o_ai
  3651. vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
  3652. return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
  3653. }
  3654. /* vec_vmaxsw */
  3655. static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
  3656. vector int __b) {
  3657. return __builtin_altivec_vmaxsw(__a, __b);
  3658. }
  3659. static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
  3660. vector int __b) {
  3661. return __builtin_altivec_vmaxsw((vector int)__a, __b);
  3662. }
  3663. static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
  3664. vector bool int __b) {
  3665. return __builtin_altivec_vmaxsw(__a, (vector int)__b);
  3666. }
  3667. /* vec_vmaxuw */
  3668. static __inline__ vector unsigned int __ATTRS_o_ai
  3669. vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
  3670. return __builtin_altivec_vmaxuw(__a, __b);
  3671. }
  3672. static __inline__ vector unsigned int __ATTRS_o_ai
  3673. vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
  3674. return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
  3675. }
  3676. static __inline__ vector unsigned int __ATTRS_o_ai
  3677. vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
  3678. return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
  3679. }
  3680. /* vec_vmaxfp */
  3681. static __inline__ vector float __attribute__((__always_inline__))
  3682. vec_vmaxfp(vector float __a, vector float __b) {
  3683. #ifdef __VSX__
  3684. return __builtin_vsx_xvmaxsp(__a, __b);
  3685. #else
  3686. return __builtin_altivec_vmaxfp(__a, __b);
  3687. #endif
  3688. }
  3689. /* vec_mergeh */
  3690. static __inline__ vector signed char __ATTRS_o_ai
  3691. vec_mergeh(vector signed char __a, vector signed char __b) {
  3692. return vec_perm(__a, __b,
  3693. (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
  3694. 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
  3695. 0x06, 0x16, 0x07, 0x17));
  3696. }
  3697. static __inline__ vector unsigned char __ATTRS_o_ai
  3698. vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
  3699. return vec_perm(__a, __b,
  3700. (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
  3701. 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
  3702. 0x06, 0x16, 0x07, 0x17));
  3703. }
  3704. static __inline__ vector bool char __ATTRS_o_ai
  3705. vec_mergeh(vector bool char __a, vector bool char __b) {
  3706. return vec_perm(__a, __b,
  3707. (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
  3708. 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
  3709. 0x06, 0x16, 0x07, 0x17));
  3710. }
  3711. static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
  3712. vector short __b) {
  3713. return vec_perm(__a, __b,
  3714. (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
  3715. 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
  3716. 0x06, 0x07, 0x16, 0x17));
  3717. }
  3718. static __inline__ vector unsigned short __ATTRS_o_ai
  3719. vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
  3720. return vec_perm(__a, __b,
  3721. (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
  3722. 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
  3723. 0x06, 0x07, 0x16, 0x17));
  3724. }
  3725. static __inline__ vector bool short __ATTRS_o_ai
  3726. vec_mergeh(vector bool short __a, vector bool short __b) {
  3727. return vec_perm(__a, __b,
  3728. (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
  3729. 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
  3730. 0x06, 0x07, 0x16, 0x17));
  3731. }
  3732. static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
  3733. vector pixel __b) {
  3734. return vec_perm(__a, __b,
  3735. (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
  3736. 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
  3737. 0x06, 0x07, 0x16, 0x17));
  3738. }
  3739. static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
  3740. vector int __b) {
  3741. return vec_perm(__a, __b,
  3742. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  3743. 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
  3744. 0x14, 0x15, 0x16, 0x17));
  3745. }
  3746. static __inline__ vector unsigned int __ATTRS_o_ai
  3747. vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
  3748. return vec_perm(__a, __b,
  3749. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  3750. 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
  3751. 0x14, 0x15, 0x16, 0x17));
  3752. }
  3753. static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
  3754. vector bool int __b) {
  3755. return vec_perm(__a, __b,
  3756. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  3757. 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
  3758. 0x14, 0x15, 0x16, 0x17));
  3759. }
  3760. static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
  3761. vector float __b) {
  3762. return vec_perm(__a, __b,
  3763. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  3764. 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
  3765. 0x14, 0x15, 0x16, 0x17));
  3766. }
  3767. #ifdef __VSX__
  3768. static __inline__ vector signed long long __ATTRS_o_ai
  3769. vec_mergeh(vector signed long long __a, vector signed long long __b) {
  3770. return vec_perm(__a, __b,
  3771. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3772. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3773. 0x14, 0x15, 0x16, 0x17));
  3774. }
  3775. static __inline__ vector signed long long __ATTRS_o_ai
  3776. vec_mergeh(vector signed long long __a, vector bool long long __b) {
  3777. return vec_perm(__a, (vector signed long long)__b,
  3778. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3779. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3780. 0x14, 0x15, 0x16, 0x17));
  3781. }
  3782. static __inline__ vector signed long long __ATTRS_o_ai
  3783. vec_mergeh(vector bool long long __a, vector signed long long __b) {
  3784. return vec_perm((vector signed long long)__a, __b,
  3785. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3786. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3787. 0x14, 0x15, 0x16, 0x17));
  3788. }
  3789. static __inline__ vector unsigned long long __ATTRS_o_ai
  3790. vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
  3791. return vec_perm(__a, __b,
  3792. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3793. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3794. 0x14, 0x15, 0x16, 0x17));
  3795. }
  3796. static __inline__ vector unsigned long long __ATTRS_o_ai
  3797. vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
  3798. return vec_perm(__a, (vector unsigned long long)__b,
  3799. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3800. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3801. 0x14, 0x15, 0x16, 0x17));
  3802. }
  3803. static __inline__ vector unsigned long long __ATTRS_o_ai
  3804. vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
  3805. return vec_perm((vector unsigned long long)__a, __b,
  3806. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3807. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3808. 0x14, 0x15, 0x16, 0x17));
  3809. }
  3810. static __inline__ vector bool long long __ATTRS_o_ai
  3811. vec_mergeh(vector bool long long __a, vector bool long long __b) {
  3812. return vec_perm(__a, __b,
  3813. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3814. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3815. 0x14, 0x15, 0x16, 0x17));
  3816. }
  3817. static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
  3818. vector double __b) {
  3819. return vec_perm(__a, __b,
  3820. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3821. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3822. 0x14, 0x15, 0x16, 0x17));
  3823. }
  3824. static __inline__ vector double __ATTRS_o_ai
  3825. vec_mergeh(vector double __a, vector bool long long __b) {
  3826. return vec_perm(__a, (vector double)__b,
  3827. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3828. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3829. 0x14, 0x15, 0x16, 0x17));
  3830. }
  3831. static __inline__ vector double __ATTRS_o_ai
  3832. vec_mergeh(vector bool long long __a, vector double __b) {
  3833. return vec_perm((vector double)__a, __b,
  3834. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
  3835. 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
  3836. 0x14, 0x15, 0x16, 0x17));
  3837. }
  3838. #endif
  3839. /* vec_vmrghb */
  3840. #define __builtin_altivec_vmrghb vec_vmrghb
  3841. static __inline__ vector signed char __ATTRS_o_ai
  3842. vec_vmrghb(vector signed char __a, vector signed char __b) {
  3843. return vec_perm(__a, __b,
  3844. (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
  3845. 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
  3846. 0x06, 0x16, 0x07, 0x17));
  3847. }
  3848. static __inline__ vector unsigned char __ATTRS_o_ai
  3849. vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
  3850. return vec_perm(__a, __b,
  3851. (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
  3852. 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
  3853. 0x06, 0x16, 0x07, 0x17));
  3854. }
  3855. static __inline__ vector bool char __ATTRS_o_ai
  3856. vec_vmrghb(vector bool char __a, vector bool char __b) {
  3857. return vec_perm(__a, __b,
  3858. (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
  3859. 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
  3860. 0x06, 0x16, 0x07, 0x17));
  3861. }
  3862. /* vec_vmrghh */
  3863. #define __builtin_altivec_vmrghh vec_vmrghh
  3864. static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
  3865. vector short __b) {
  3866. return vec_perm(__a, __b,
  3867. (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
  3868. 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
  3869. 0x06, 0x07, 0x16, 0x17));
  3870. }
  3871. static __inline__ vector unsigned short __ATTRS_o_ai
  3872. vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
  3873. return vec_perm(__a, __b,
  3874. (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
  3875. 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
  3876. 0x06, 0x07, 0x16, 0x17));
  3877. }
  3878. static __inline__ vector bool short __ATTRS_o_ai
  3879. vec_vmrghh(vector bool short __a, vector bool short __b) {
  3880. return vec_perm(__a, __b,
  3881. (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
  3882. 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
  3883. 0x06, 0x07, 0x16, 0x17));
  3884. }
  3885. static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
  3886. vector pixel __b) {
  3887. return vec_perm(__a, __b,
  3888. (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
  3889. 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
  3890. 0x06, 0x07, 0x16, 0x17));
  3891. }
  3892. /* vec_vmrghw */
  3893. #define __builtin_altivec_vmrghw vec_vmrghw
  3894. static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
  3895. vector int __b) {
  3896. return vec_perm(__a, __b,
  3897. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  3898. 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
  3899. 0x14, 0x15, 0x16, 0x17));
  3900. }
  3901. static __inline__ vector unsigned int __ATTRS_o_ai
  3902. vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
  3903. return vec_perm(__a, __b,
  3904. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  3905. 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
  3906. 0x14, 0x15, 0x16, 0x17));
  3907. }
  3908. static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
  3909. vector bool int __b) {
  3910. return vec_perm(__a, __b,
  3911. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  3912. 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
  3913. 0x14, 0x15, 0x16, 0x17));
  3914. }
  3915. static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
  3916. vector float __b) {
  3917. return vec_perm(__a, __b,
  3918. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  3919. 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
  3920. 0x14, 0x15, 0x16, 0x17));
  3921. }
  3922. /* vec_mergel */
  3923. static __inline__ vector signed char __ATTRS_o_ai
  3924. vec_mergel(vector signed char __a, vector signed char __b) {
  3925. return vec_perm(__a, __b,
  3926. (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
  3927. 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
  3928. 0x0E, 0x1E, 0x0F, 0x1F));
  3929. }
  3930. static __inline__ vector unsigned char __ATTRS_o_ai
  3931. vec_mergel(vector unsigned char __a, vector unsigned char __b) {
  3932. return vec_perm(__a, __b,
  3933. (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
  3934. 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
  3935. 0x0E, 0x1E, 0x0F, 0x1F));
  3936. }
  3937. static __inline__ vector bool char __ATTRS_o_ai
  3938. vec_mergel(vector bool char __a, vector bool char __b) {
  3939. return vec_perm(__a, __b,
  3940. (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
  3941. 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
  3942. 0x0E, 0x1E, 0x0F, 0x1F));
  3943. }
  3944. static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
  3945. vector short __b) {
  3946. return vec_perm(__a, __b,
  3947. (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
  3948. 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
  3949. 0x0E, 0x0F, 0x1E, 0x1F));
  3950. }
  3951. static __inline__ vector unsigned short __ATTRS_o_ai
  3952. vec_mergel(vector unsigned short __a, vector unsigned short __b) {
  3953. return vec_perm(__a, __b,
  3954. (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
  3955. 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
  3956. 0x0E, 0x0F, 0x1E, 0x1F));
  3957. }
  3958. static __inline__ vector bool short __ATTRS_o_ai
  3959. vec_mergel(vector bool short __a, vector bool short __b) {
  3960. return vec_perm(__a, __b,
  3961. (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
  3962. 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
  3963. 0x0E, 0x0F, 0x1E, 0x1F));
  3964. }
  3965. static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
  3966. vector pixel __b) {
  3967. return vec_perm(__a, __b,
  3968. (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
  3969. 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
  3970. 0x0E, 0x0F, 0x1E, 0x1F));
  3971. }
  3972. static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
  3973. vector int __b) {
  3974. return vec_perm(__a, __b,
  3975. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
  3976. 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
  3977. 0x1C, 0x1D, 0x1E, 0x1F));
  3978. }
  3979. static __inline__ vector unsigned int __ATTRS_o_ai
  3980. vec_mergel(vector unsigned int __a, vector unsigned int __b) {
  3981. return vec_perm(__a, __b,
  3982. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
  3983. 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
  3984. 0x1C, 0x1D, 0x1E, 0x1F));
  3985. }
  3986. static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
  3987. vector bool int __b) {
  3988. return vec_perm(__a, __b,
  3989. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
  3990. 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
  3991. 0x1C, 0x1D, 0x1E, 0x1F));
  3992. }
  3993. static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
  3994. vector float __b) {
  3995. return vec_perm(__a, __b,
  3996. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
  3997. 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
  3998. 0x1C, 0x1D, 0x1E, 0x1F));
  3999. }
  4000. #ifdef __VSX__
  4001. static __inline__ vector signed long long __ATTRS_o_ai
  4002. vec_mergel(vector signed long long __a, vector signed long long __b) {
  4003. return vec_perm(__a, __b,
  4004. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4005. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4006. 0x1C, 0x1D, 0x1E, 0x1F));
  4007. }
  4008. static __inline__ vector signed long long __ATTRS_o_ai
  4009. vec_mergel(vector signed long long __a, vector bool long long __b) {
  4010. return vec_perm(__a, (vector signed long long)__b,
  4011. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4012. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4013. 0x1C, 0x1D, 0x1E, 0x1F));
  4014. }
  4015. static __inline__ vector signed long long __ATTRS_o_ai
  4016. vec_mergel(vector bool long long __a, vector signed long long __b) {
  4017. return vec_perm((vector signed long long)__a, __b,
  4018. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4019. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4020. 0x1C, 0x1D, 0x1E, 0x1F));
  4021. }
  4022. static __inline__ vector unsigned long long __ATTRS_o_ai
  4023. vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
  4024. return vec_perm(__a, __b,
  4025. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4026. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4027. 0x1C, 0x1D, 0x1E, 0x1F));
  4028. }
  4029. static __inline__ vector unsigned long long __ATTRS_o_ai
  4030. vec_mergel(vector unsigned long long __a, vector bool long long __b) {
  4031. return vec_perm(__a, (vector unsigned long long)__b,
  4032. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4033. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4034. 0x1C, 0x1D, 0x1E, 0x1F));
  4035. }
  4036. static __inline__ vector unsigned long long __ATTRS_o_ai
  4037. vec_mergel(vector bool long long __a, vector unsigned long long __b) {
  4038. return vec_perm((vector unsigned long long)__a, __b,
  4039. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4040. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4041. 0x1C, 0x1D, 0x1E, 0x1F));
  4042. }
  4043. static __inline__ vector bool long long __ATTRS_o_ai
  4044. vec_mergel(vector bool long long __a, vector bool long long __b) {
  4045. return vec_perm(__a, __b,
  4046. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4047. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4048. 0x1C, 0x1D, 0x1E, 0x1F));
  4049. }
  4050. static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
  4051. vector double __b) {
  4052. return vec_perm(__a, __b,
  4053. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4054. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4055. 0x1C, 0x1D, 0x1E, 0x1F));
  4056. }
  4057. static __inline__ vector double __ATTRS_o_ai
  4058. vec_mergel(vector double __a, vector bool long long __b) {
  4059. return vec_perm(__a, (vector double)__b,
  4060. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4061. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4062. 0x1C, 0x1D, 0x1E, 0x1F));
  4063. }
  4064. static __inline__ vector double __ATTRS_o_ai
  4065. vec_mergel(vector bool long long __a, vector double __b) {
  4066. return vec_perm((vector double)__a, __b,
  4067. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
  4068. 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
  4069. 0x1C, 0x1D, 0x1E, 0x1F));
  4070. }
  4071. #endif
  4072. /* vec_vmrglb */
  4073. #define __builtin_altivec_vmrglb vec_vmrglb
  4074. static __inline__ vector signed char __ATTRS_o_ai
  4075. vec_vmrglb(vector signed char __a, vector signed char __b) {
  4076. return vec_perm(__a, __b,
  4077. (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
  4078. 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
  4079. 0x0E, 0x1E, 0x0F, 0x1F));
  4080. }
  4081. static __inline__ vector unsigned char __ATTRS_o_ai
  4082. vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
  4083. return vec_perm(__a, __b,
  4084. (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
  4085. 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
  4086. 0x0E, 0x1E, 0x0F, 0x1F));
  4087. }
  4088. static __inline__ vector bool char __ATTRS_o_ai
  4089. vec_vmrglb(vector bool char __a, vector bool char __b) {
  4090. return vec_perm(__a, __b,
  4091. (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
  4092. 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
  4093. 0x0E, 0x1E, 0x0F, 0x1F));
  4094. }
  4095. /* vec_vmrglh */
  4096. #define __builtin_altivec_vmrglh vec_vmrglh
  4097. static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
  4098. vector short __b) {
  4099. return vec_perm(__a, __b,
  4100. (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
  4101. 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
  4102. 0x0E, 0x0F, 0x1E, 0x1F));
  4103. }
  4104. static __inline__ vector unsigned short __ATTRS_o_ai
  4105. vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
  4106. return vec_perm(__a, __b,
  4107. (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
  4108. 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
  4109. 0x0E, 0x0F, 0x1E, 0x1F));
  4110. }
  4111. static __inline__ vector bool short __ATTRS_o_ai
  4112. vec_vmrglh(vector bool short __a, vector bool short __b) {
  4113. return vec_perm(__a, __b,
  4114. (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
  4115. 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
  4116. 0x0E, 0x0F, 0x1E, 0x1F));
  4117. }
  4118. static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
  4119. vector pixel __b) {
  4120. return vec_perm(__a, __b,
  4121. (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
  4122. 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
  4123. 0x0E, 0x0F, 0x1E, 0x1F));
  4124. }
  4125. /* vec_vmrglw */
  4126. #define __builtin_altivec_vmrglw vec_vmrglw
  4127. static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
  4128. vector int __b) {
  4129. return vec_perm(__a, __b,
  4130. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
  4131. 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
  4132. 0x1C, 0x1D, 0x1E, 0x1F));
  4133. }
  4134. static __inline__ vector unsigned int __ATTRS_o_ai
  4135. vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
  4136. return vec_perm(__a, __b,
  4137. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
  4138. 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
  4139. 0x1C, 0x1D, 0x1E, 0x1F));
  4140. }
  4141. static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
  4142. vector bool int __b) {
  4143. return vec_perm(__a, __b,
  4144. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
  4145. 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
  4146. 0x1C, 0x1D, 0x1E, 0x1F));
  4147. }
  4148. static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
  4149. vector float __b) {
  4150. return vec_perm(__a, __b,
  4151. (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
  4152. 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
  4153. 0x1C, 0x1D, 0x1E, 0x1F));
  4154. }
  4155. #ifdef __POWER8_VECTOR__
  4156. /* vec_mergee */
  4157. static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
  4158. vector bool int __b) {
  4159. return vec_perm(__a, __b,
  4160. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  4161. 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
  4162. 0x18, 0x19, 0x1A, 0x1B));
  4163. }
  4164. static __inline__ vector signed int __ATTRS_o_ai
  4165. vec_mergee(vector signed int __a, vector signed int __b) {
  4166. return vec_perm(__a, __b,
  4167. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  4168. 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
  4169. 0x18, 0x19, 0x1A, 0x1B));
  4170. }
  4171. static __inline__ vector unsigned int __ATTRS_o_ai
  4172. vec_mergee(vector unsigned int __a, vector unsigned int __b) {
  4173. return vec_perm(__a, __b,
  4174. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  4175. 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
  4176. 0x18, 0x19, 0x1A, 0x1B));
  4177. }
  4178. static __inline__ vector bool long long __ATTRS_o_ai
  4179. vec_mergee(vector bool long long __a, vector bool long long __b) {
  4180. return vec_mergeh(__a, __b);
  4181. }
  4182. static __inline__ vector signed long long __ATTRS_o_ai
  4183. vec_mergee(vector signed long long __a, vector signed long long __b) {
  4184. return vec_mergeh(__a, __b);
  4185. }
  4186. static __inline__ vector unsigned long long __ATTRS_o_ai
  4187. vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
  4188. return vec_mergeh(__a, __b);
  4189. }
  4190. static __inline__ vector float __ATTRS_o_ai
  4191. vec_mergee(vector float __a, vector float __b) {
  4192. return vec_perm(__a, __b,
  4193. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
  4194. 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
  4195. 0x18, 0x19, 0x1A, 0x1B));
  4196. }
  4197. static __inline__ vector double __ATTRS_o_ai
  4198. vec_mergee(vector double __a, vector double __b) {
  4199. return vec_mergeh(__a, __b);
  4200. }
  4201. /* vec_mergeo */
  4202. static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
  4203. vector bool int __b) {
  4204. return vec_perm(__a, __b,
  4205. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
  4206. 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
  4207. 0x1C, 0x1D, 0x1E, 0x1F));
  4208. }
  4209. static __inline__ vector signed int __ATTRS_o_ai
  4210. vec_mergeo(vector signed int __a, vector signed int __b) {
  4211. return vec_perm(__a, __b,
  4212. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
  4213. 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
  4214. 0x1C, 0x1D, 0x1E, 0x1F));
  4215. }
  4216. static __inline__ vector unsigned int __ATTRS_o_ai
  4217. vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
  4218. return vec_perm(__a, __b,
  4219. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
  4220. 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
  4221. 0x1C, 0x1D, 0x1E, 0x1F));
  4222. }
  4223. static __inline__ vector bool long long __ATTRS_o_ai
  4224. vec_mergeo(vector bool long long __a, vector bool long long __b) {
  4225. return vec_mergel(__a, __b);
  4226. }
  4227. static __inline__ vector signed long long __ATTRS_o_ai
  4228. vec_mergeo(vector signed long long __a, vector signed long long __b) {
  4229. return vec_mergel(__a, __b);
  4230. }
  4231. static __inline__ vector unsigned long long __ATTRS_o_ai
  4232. vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
  4233. return vec_mergel(__a, __b);
  4234. }
  4235. static __inline__ vector float __ATTRS_o_ai
  4236. vec_mergeo(vector float __a, vector float __b) {
  4237. return vec_perm(__a, __b,
  4238. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
  4239. 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
  4240. 0x1C, 0x1D, 0x1E, 0x1F));
  4241. }
  4242. static __inline__ vector double __ATTRS_o_ai
  4243. vec_mergeo(vector double __a, vector double __b) {
  4244. return vec_mergel(__a, __b);
  4245. }
  4246. #endif
  4247. /* vec_mfvscr */
  4248. static __inline__ vector unsigned short __attribute__((__always_inline__))
  4249. vec_mfvscr(void) {
  4250. return __builtin_altivec_mfvscr();
  4251. }
  4252. /* vec_min */
  4253. static __inline__ vector signed char __ATTRS_o_ai
  4254. vec_min(vector signed char __a, vector signed char __b) {
  4255. return __builtin_altivec_vminsb(__a, __b);
  4256. }
  4257. static __inline__ vector signed char __ATTRS_o_ai
  4258. vec_min(vector bool char __a, vector signed char __b) {
  4259. return __builtin_altivec_vminsb((vector signed char)__a, __b);
  4260. }
  4261. static __inline__ vector signed char __ATTRS_o_ai
  4262. vec_min(vector signed char __a, vector bool char __b) {
  4263. return __builtin_altivec_vminsb(__a, (vector signed char)__b);
  4264. }
  4265. static __inline__ vector unsigned char __ATTRS_o_ai
  4266. vec_min(vector unsigned char __a, vector unsigned char __b) {
  4267. return __builtin_altivec_vminub(__a, __b);
  4268. }
  4269. static __inline__ vector unsigned char __ATTRS_o_ai
  4270. vec_min(vector bool char __a, vector unsigned char __b) {
  4271. return __builtin_altivec_vminub((vector unsigned char)__a, __b);
  4272. }
  4273. static __inline__ vector unsigned char __ATTRS_o_ai
  4274. vec_min(vector unsigned char __a, vector bool char __b) {
  4275. return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
  4276. }
  4277. static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
  4278. vector short __b) {
  4279. return __builtin_altivec_vminsh(__a, __b);
  4280. }
  4281. static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
  4282. vector short __b) {
  4283. return __builtin_altivec_vminsh((vector short)__a, __b);
  4284. }
  4285. static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
  4286. vector bool short __b) {
  4287. return __builtin_altivec_vminsh(__a, (vector short)__b);
  4288. }
  4289. static __inline__ vector unsigned short __ATTRS_o_ai
  4290. vec_min(vector unsigned short __a, vector unsigned short __b) {
  4291. return __builtin_altivec_vminuh(__a, __b);
  4292. }
  4293. static __inline__ vector unsigned short __ATTRS_o_ai
  4294. vec_min(vector bool short __a, vector unsigned short __b) {
  4295. return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
  4296. }
  4297. static __inline__ vector unsigned short __ATTRS_o_ai
  4298. vec_min(vector unsigned short __a, vector bool short __b) {
  4299. return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
  4300. }
  4301. static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
  4302. vector int __b) {
  4303. return __builtin_altivec_vminsw(__a, __b);
  4304. }
  4305. static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
  4306. vector int __b) {
  4307. return __builtin_altivec_vminsw((vector int)__a, __b);
  4308. }
  4309. static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
  4310. vector bool int __b) {
  4311. return __builtin_altivec_vminsw(__a, (vector int)__b);
  4312. }
  4313. static __inline__ vector unsigned int __ATTRS_o_ai
  4314. vec_min(vector unsigned int __a, vector unsigned int __b) {
  4315. return __builtin_altivec_vminuw(__a, __b);
  4316. }
  4317. static __inline__ vector unsigned int __ATTRS_o_ai
  4318. vec_min(vector bool int __a, vector unsigned int __b) {
  4319. return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
  4320. }
  4321. static __inline__ vector unsigned int __ATTRS_o_ai
  4322. vec_min(vector unsigned int __a, vector bool int __b) {
  4323. return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
  4324. }
  4325. #ifdef __POWER8_VECTOR__
  4326. static __inline__ vector signed long long __ATTRS_o_ai
  4327. vec_min(vector signed long long __a, vector signed long long __b) {
  4328. return __builtin_altivec_vminsd(__a, __b);
  4329. }
  4330. static __inline__ vector signed long long __ATTRS_o_ai
  4331. vec_min(vector bool long long __a, vector signed long long __b) {
  4332. return __builtin_altivec_vminsd((vector signed long long)__a, __b);
  4333. }
  4334. static __inline__ vector signed long long __ATTRS_o_ai
  4335. vec_min(vector signed long long __a, vector bool long long __b) {
  4336. return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
  4337. }
  4338. static __inline__ vector unsigned long long __ATTRS_o_ai
  4339. vec_min(vector unsigned long long __a, vector unsigned long long __b) {
  4340. return __builtin_altivec_vminud(__a, __b);
  4341. }
  4342. static __inline__ vector unsigned long long __ATTRS_o_ai
  4343. vec_min(vector bool long long __a, vector unsigned long long __b) {
  4344. return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
  4345. }
  4346. static __inline__ vector unsigned long long __ATTRS_o_ai
  4347. vec_min(vector unsigned long long __a, vector bool long long __b) {
  4348. return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
  4349. }
  4350. #endif
  4351. static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
  4352. vector float __b) {
  4353. #ifdef __VSX__
  4354. return __builtin_vsx_xvminsp(__a, __b);
  4355. #else
  4356. return __builtin_altivec_vminfp(__a, __b);
  4357. #endif
  4358. }
  4359. #ifdef __VSX__
  4360. static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
  4361. vector double __b) {
  4362. return __builtin_vsx_xvmindp(__a, __b);
  4363. }
  4364. #endif
  4365. /* vec_vminsb */
  4366. static __inline__ vector signed char __ATTRS_o_ai
  4367. vec_vminsb(vector signed char __a, vector signed char __b) {
  4368. return __builtin_altivec_vminsb(__a, __b);
  4369. }
  4370. static __inline__ vector signed char __ATTRS_o_ai
  4371. vec_vminsb(vector bool char __a, vector signed char __b) {
  4372. return __builtin_altivec_vminsb((vector signed char)__a, __b);
  4373. }
  4374. static __inline__ vector signed char __ATTRS_o_ai
  4375. vec_vminsb(vector signed char __a, vector bool char __b) {
  4376. return __builtin_altivec_vminsb(__a, (vector signed char)__b);
  4377. }
  4378. /* vec_vminub */
  4379. static __inline__ vector unsigned char __ATTRS_o_ai
  4380. vec_vminub(vector unsigned char __a, vector unsigned char __b) {
  4381. return __builtin_altivec_vminub(__a, __b);
  4382. }
  4383. static __inline__ vector unsigned char __ATTRS_o_ai
  4384. vec_vminub(vector bool char __a, vector unsigned char __b) {
  4385. return __builtin_altivec_vminub((vector unsigned char)__a, __b);
  4386. }
  4387. static __inline__ vector unsigned char __ATTRS_o_ai
  4388. vec_vminub(vector unsigned char __a, vector bool char __b) {
  4389. return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
  4390. }
  4391. /* vec_vminsh */
  4392. static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
  4393. vector short __b) {
  4394. return __builtin_altivec_vminsh(__a, __b);
  4395. }
  4396. static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
  4397. vector short __b) {
  4398. return __builtin_altivec_vminsh((vector short)__a, __b);
  4399. }
  4400. static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
  4401. vector bool short __b) {
  4402. return __builtin_altivec_vminsh(__a, (vector short)__b);
  4403. }
  4404. /* vec_vminuh */
  4405. static __inline__ vector unsigned short __ATTRS_o_ai
  4406. vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
  4407. return __builtin_altivec_vminuh(__a, __b);
  4408. }
  4409. static __inline__ vector unsigned short __ATTRS_o_ai
  4410. vec_vminuh(vector bool short __a, vector unsigned short __b) {
  4411. return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
  4412. }
  4413. static __inline__ vector unsigned short __ATTRS_o_ai
  4414. vec_vminuh(vector unsigned short __a, vector bool short __b) {
  4415. return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
  4416. }
  4417. /* vec_vminsw */
  4418. static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
  4419. vector int __b) {
  4420. return __builtin_altivec_vminsw(__a, __b);
  4421. }
  4422. static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
  4423. vector int __b) {
  4424. return __builtin_altivec_vminsw((vector int)__a, __b);
  4425. }
  4426. static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
  4427. vector bool int __b) {
  4428. return __builtin_altivec_vminsw(__a, (vector int)__b);
  4429. }
  4430. /* vec_vminuw */
  4431. static __inline__ vector unsigned int __ATTRS_o_ai
  4432. vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
  4433. return __builtin_altivec_vminuw(__a, __b);
  4434. }
  4435. static __inline__ vector unsigned int __ATTRS_o_ai
  4436. vec_vminuw(vector bool int __a, vector unsigned int __b) {
  4437. return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
  4438. }
  4439. static __inline__ vector unsigned int __ATTRS_o_ai
  4440. vec_vminuw(vector unsigned int __a, vector bool int __b) {
  4441. return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
  4442. }
  4443. /* vec_vminfp */
  4444. static __inline__ vector float __attribute__((__always_inline__))
  4445. vec_vminfp(vector float __a, vector float __b) {
  4446. #ifdef __VSX__
  4447. return __builtin_vsx_xvminsp(__a, __b);
  4448. #else
  4449. return __builtin_altivec_vminfp(__a, __b);
  4450. #endif
  4451. }
  4452. /* vec_mladd */
  4453. #define __builtin_altivec_vmladduhm vec_mladd
  4454. static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
  4455. vector short __b,
  4456. vector short __c) {
  4457. return __a * __b + __c;
  4458. }
  4459. static __inline__ vector short __ATTRS_o_ai vec_mladd(
  4460. vector short __a, vector unsigned short __b, vector unsigned short __c) {
  4461. return __a * (vector short)__b + (vector short)__c;
  4462. }
  4463. static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
  4464. vector short __b,
  4465. vector short __c) {
  4466. return (vector short)__a * __b + __c;
  4467. }
  4468. static __inline__ vector unsigned short __ATTRS_o_ai
  4469. vec_mladd(vector unsigned short __a, vector unsigned short __b,
  4470. vector unsigned short __c) {
  4471. return __a * __b + __c;
  4472. }
  4473. /* vec_vmladduhm */
  4474. static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
  4475. vector short __b,
  4476. vector short __c) {
  4477. return __a * __b + __c;
  4478. }
  4479. static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
  4480. vector short __a, vector unsigned short __b, vector unsigned short __c) {
  4481. return __a * (vector short)__b + (vector short)__c;
  4482. }
  4483. static __inline__ vector short __ATTRS_o_ai
  4484. vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
  4485. return (vector short)__a * __b + __c;
  4486. }
  4487. static __inline__ vector unsigned short __ATTRS_o_ai
  4488. vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
  4489. vector unsigned short __c) {
  4490. return __a * __b + __c;
  4491. }
  4492. /* vec_mradds */
  4493. static __inline__ vector short __attribute__((__always_inline__))
  4494. vec_mradds(vector short __a, vector short __b, vector short __c) {
  4495. return __builtin_altivec_vmhraddshs(__a, __b, __c);
  4496. }
  4497. /* vec_vmhraddshs */
  4498. static __inline__ vector short __attribute__((__always_inline__))
  4499. vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
  4500. return __builtin_altivec_vmhraddshs(__a, __b, __c);
  4501. }
  4502. /* vec_msum */
  4503. static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
  4504. vector unsigned char __b,
  4505. vector int __c) {
  4506. return __builtin_altivec_vmsummbm(__a, __b, __c);
  4507. }
  4508. static __inline__ vector unsigned int __ATTRS_o_ai
  4509. vec_msum(vector unsigned char __a, vector unsigned char __b,
  4510. vector unsigned int __c) {
  4511. return __builtin_altivec_vmsumubm(__a, __b, __c);
  4512. }
  4513. static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
  4514. vector short __b,
  4515. vector int __c) {
  4516. return __builtin_altivec_vmsumshm(__a, __b, __c);
  4517. }
  4518. static __inline__ vector unsigned int __ATTRS_o_ai
  4519. vec_msum(vector unsigned short __a, vector unsigned short __b,
  4520. vector unsigned int __c) {
  4521. return __builtin_altivec_vmsumuhm(__a, __b, __c);
  4522. }
  4523. /* vec_vmsummbm */
  4524. static __inline__ vector int __attribute__((__always_inline__))
  4525. vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
  4526. return __builtin_altivec_vmsummbm(__a, __b, __c);
  4527. }
  4528. /* vec_vmsumubm */
  4529. static __inline__ vector unsigned int __attribute__((__always_inline__))
  4530. vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
  4531. vector unsigned int __c) {
  4532. return __builtin_altivec_vmsumubm(__a, __b, __c);
  4533. }
  4534. /* vec_vmsumshm */
  4535. static __inline__ vector int __attribute__((__always_inline__))
  4536. vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
  4537. return __builtin_altivec_vmsumshm(__a, __b, __c);
  4538. }
  4539. /* vec_vmsumuhm */
  4540. static __inline__ vector unsigned int __attribute__((__always_inline__))
  4541. vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
  4542. vector unsigned int __c) {
  4543. return __builtin_altivec_vmsumuhm(__a, __b, __c);
  4544. }
  4545. /* vec_msums */
  4546. static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
  4547. vector short __b,
  4548. vector int __c) {
  4549. return __builtin_altivec_vmsumshs(__a, __b, __c);
  4550. }
  4551. static __inline__ vector unsigned int __ATTRS_o_ai
  4552. vec_msums(vector unsigned short __a, vector unsigned short __b,
  4553. vector unsigned int __c) {
  4554. return __builtin_altivec_vmsumuhs(__a, __b, __c);
  4555. }
  4556. /* vec_vmsumshs */
  4557. static __inline__ vector int __attribute__((__always_inline__))
  4558. vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
  4559. return __builtin_altivec_vmsumshs(__a, __b, __c);
  4560. }
  4561. /* vec_vmsumuhs */
  4562. static __inline__ vector unsigned int __attribute__((__always_inline__))
  4563. vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
  4564. vector unsigned int __c) {
  4565. return __builtin_altivec_vmsumuhs(__a, __b, __c);
  4566. }
  4567. /* vec_mtvscr */
  4568. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
  4569. __builtin_altivec_mtvscr((vector int)__a);
  4570. }
  4571. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
  4572. __builtin_altivec_mtvscr((vector int)__a);
  4573. }
  4574. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
  4575. __builtin_altivec_mtvscr((vector int)__a);
  4576. }
  4577. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
  4578. __builtin_altivec_mtvscr((vector int)__a);
  4579. }
  4580. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
  4581. __builtin_altivec_mtvscr((vector int)__a);
  4582. }
  4583. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
  4584. __builtin_altivec_mtvscr((vector int)__a);
  4585. }
  4586. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
  4587. __builtin_altivec_mtvscr((vector int)__a);
  4588. }
  4589. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
  4590. __builtin_altivec_mtvscr((vector int)__a);
  4591. }
  4592. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
  4593. __builtin_altivec_mtvscr((vector int)__a);
  4594. }
  4595. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
  4596. __builtin_altivec_mtvscr((vector int)__a);
  4597. }
  4598. static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
  4599. __builtin_altivec_mtvscr((vector int)__a);
  4600. }
  4601. /* vec_mul */
  4602. /* Integer vector multiplication will involve multiplication of the odd/even
  4603. elements separately, then truncating the results and moving to the
  4604. result vector.
  4605. */
  4606. static __inline__ vector signed char __ATTRS_o_ai
  4607. vec_mul(vector signed char __a, vector signed char __b) {
  4608. return __a * __b;
  4609. }
  4610. static __inline__ vector unsigned char __ATTRS_o_ai
  4611. vec_mul(vector unsigned char __a, vector unsigned char __b) {
  4612. return __a * __b;
  4613. }
  4614. static __inline__ vector signed short __ATTRS_o_ai
  4615. vec_mul(vector signed short __a, vector signed short __b) {
  4616. return __a * __b;
  4617. }
  4618. static __inline__ vector unsigned short __ATTRS_o_ai
  4619. vec_mul(vector unsigned short __a, vector unsigned short __b) {
  4620. return __a * __b;
  4621. }
  4622. static __inline__ vector signed int __ATTRS_o_ai
  4623. vec_mul(vector signed int __a, vector signed int __b) {
  4624. return __a * __b;
  4625. }
  4626. static __inline__ vector unsigned int __ATTRS_o_ai
  4627. vec_mul(vector unsigned int __a, vector unsigned int __b) {
  4628. return __a * __b;
  4629. }
  4630. #ifdef __VSX__
  4631. static __inline__ vector signed long long __ATTRS_o_ai
  4632. vec_mul(vector signed long long __a, vector signed long long __b) {
  4633. return __a * __b;
  4634. }
  4635. static __inline__ vector unsigned long long __ATTRS_o_ai
  4636. vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
  4637. return __a * __b;
  4638. }
  4639. #endif
  4640. static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
  4641. vector float __b) {
  4642. return __a * __b;
  4643. }
  4644. #ifdef __VSX__
  4645. static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
  4646. vector double __b) {
  4647. return __a * __b;
  4648. }
  4649. #endif
  4650. /* The vmulos* and vmules* instructions have a big endian bias, so
  4651. we must reverse the meaning of "even" and "odd" for little endian. */
  4652. /* vec_mule */
  4653. static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
  4654. vector signed char __b) {
  4655. #ifdef __LITTLE_ENDIAN__
  4656. return __builtin_altivec_vmulosb(__a, __b);
  4657. #else
  4658. return __builtin_altivec_vmulesb(__a, __b);
  4659. #endif
  4660. }
  4661. static __inline__ vector unsigned short __ATTRS_o_ai
  4662. vec_mule(vector unsigned char __a, vector unsigned char __b) {
  4663. #ifdef __LITTLE_ENDIAN__
  4664. return __builtin_altivec_vmuloub(__a, __b);
  4665. #else
  4666. return __builtin_altivec_vmuleub(__a, __b);
  4667. #endif
  4668. }
  4669. static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
  4670. vector short __b) {
  4671. #ifdef __LITTLE_ENDIAN__
  4672. return __builtin_altivec_vmulosh(__a, __b);
  4673. #else
  4674. return __builtin_altivec_vmulesh(__a, __b);
  4675. #endif
  4676. }
  4677. static __inline__ vector unsigned int __ATTRS_o_ai
  4678. vec_mule(vector unsigned short __a, vector unsigned short __b) {
  4679. #ifdef __LITTLE_ENDIAN__
  4680. return __builtin_altivec_vmulouh(__a, __b);
  4681. #else
  4682. return __builtin_altivec_vmuleuh(__a, __b);
  4683. #endif
  4684. }
  4685. #ifdef __POWER8_VECTOR__
  4686. static __inline__ vector signed long long __ATTRS_o_ai
  4687. vec_mule(vector signed int __a, vector signed int __b) {
  4688. #ifdef __LITTLE_ENDIAN__
  4689. return __builtin_altivec_vmulosw(__a, __b);
  4690. #else
  4691. return __builtin_altivec_vmulesw(__a, __b);
  4692. #endif
  4693. }
  4694. static __inline__ vector unsigned long long __ATTRS_o_ai
  4695. vec_mule(vector unsigned int __a, vector unsigned int __b) {
  4696. #ifdef __LITTLE_ENDIAN__
  4697. return __builtin_altivec_vmulouw(__a, __b);
  4698. #else
  4699. return __builtin_altivec_vmuleuw(__a, __b);
  4700. #endif
  4701. }
  4702. #endif
  4703. /* vec_vmulesb */
  4704. static __inline__ vector short __attribute__((__always_inline__))
  4705. vec_vmulesb(vector signed char __a, vector signed char __b) {
  4706. #ifdef __LITTLE_ENDIAN__
  4707. return __builtin_altivec_vmulosb(__a, __b);
  4708. #else
  4709. return __builtin_altivec_vmulesb(__a, __b);
  4710. #endif
  4711. }
  4712. /* vec_vmuleub */
  4713. static __inline__ vector unsigned short __attribute__((__always_inline__))
  4714. vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
  4715. #ifdef __LITTLE_ENDIAN__
  4716. return __builtin_altivec_vmuloub(__a, __b);
  4717. #else
  4718. return __builtin_altivec_vmuleub(__a, __b);
  4719. #endif
  4720. }
  4721. /* vec_vmulesh */
  4722. static __inline__ vector int __attribute__((__always_inline__))
  4723. vec_vmulesh(vector short __a, vector short __b) {
  4724. #ifdef __LITTLE_ENDIAN__
  4725. return __builtin_altivec_vmulosh(__a, __b);
  4726. #else
  4727. return __builtin_altivec_vmulesh(__a, __b);
  4728. #endif
  4729. }
  4730. /* vec_vmuleuh */
  4731. static __inline__ vector unsigned int __attribute__((__always_inline__))
  4732. vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
  4733. #ifdef __LITTLE_ENDIAN__
  4734. return __builtin_altivec_vmulouh(__a, __b);
  4735. #else
  4736. return __builtin_altivec_vmuleuh(__a, __b);
  4737. #endif
  4738. }
  4739. /* vec_mulo */
  4740. static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
  4741. vector signed char __b) {
  4742. #ifdef __LITTLE_ENDIAN__
  4743. return __builtin_altivec_vmulesb(__a, __b);
  4744. #else
  4745. return __builtin_altivec_vmulosb(__a, __b);
  4746. #endif
  4747. }
  4748. static __inline__ vector unsigned short __ATTRS_o_ai
  4749. vec_mulo(vector unsigned char __a, vector unsigned char __b) {
  4750. #ifdef __LITTLE_ENDIAN__
  4751. return __builtin_altivec_vmuleub(__a, __b);
  4752. #else
  4753. return __builtin_altivec_vmuloub(__a, __b);
  4754. #endif
  4755. }
  4756. static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
  4757. vector short __b) {
  4758. #ifdef __LITTLE_ENDIAN__
  4759. return __builtin_altivec_vmulesh(__a, __b);
  4760. #else
  4761. return __builtin_altivec_vmulosh(__a, __b);
  4762. #endif
  4763. }
  4764. static __inline__ vector unsigned int __ATTRS_o_ai
  4765. vec_mulo(vector unsigned short __a, vector unsigned short __b) {
  4766. #ifdef __LITTLE_ENDIAN__
  4767. return __builtin_altivec_vmuleuh(__a, __b);
  4768. #else
  4769. return __builtin_altivec_vmulouh(__a, __b);
  4770. #endif
  4771. }
  4772. #ifdef __POWER8_VECTOR__
  4773. static __inline__ vector signed long long __ATTRS_o_ai
  4774. vec_mulo(vector signed int __a, vector signed int __b) {
  4775. #ifdef __LITTLE_ENDIAN__
  4776. return __builtin_altivec_vmulesw(__a, __b);
  4777. #else
  4778. return __builtin_altivec_vmulosw(__a, __b);
  4779. #endif
  4780. }
  4781. static __inline__ vector unsigned long long __ATTRS_o_ai
  4782. vec_mulo(vector unsigned int __a, vector unsigned int __b) {
  4783. #ifdef __LITTLE_ENDIAN__
  4784. return __builtin_altivec_vmuleuw(__a, __b);
  4785. #else
  4786. return __builtin_altivec_vmulouw(__a, __b);
  4787. #endif
  4788. }
  4789. #endif
  4790. /* vec_vmulosb */
  4791. static __inline__ vector short __attribute__((__always_inline__))
  4792. vec_vmulosb(vector signed char __a, vector signed char __b) {
  4793. #ifdef __LITTLE_ENDIAN__
  4794. return __builtin_altivec_vmulesb(__a, __b);
  4795. #else
  4796. return __builtin_altivec_vmulosb(__a, __b);
  4797. #endif
  4798. }
  4799. /* vec_vmuloub */
  4800. static __inline__ vector unsigned short __attribute__((__always_inline__))
  4801. vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
  4802. #ifdef __LITTLE_ENDIAN__
  4803. return __builtin_altivec_vmuleub(__a, __b);
  4804. #else
  4805. return __builtin_altivec_vmuloub(__a, __b);
  4806. #endif
  4807. }
  4808. /* vec_vmulosh */
  4809. static __inline__ vector int __attribute__((__always_inline__))
  4810. vec_vmulosh(vector short __a, vector short __b) {
  4811. #ifdef __LITTLE_ENDIAN__
  4812. return __builtin_altivec_vmulesh(__a, __b);
  4813. #else
  4814. return __builtin_altivec_vmulosh(__a, __b);
  4815. #endif
  4816. }
  4817. /* vec_vmulouh */
  4818. static __inline__ vector unsigned int __attribute__((__always_inline__))
  4819. vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
  4820. #ifdef __LITTLE_ENDIAN__
  4821. return __builtin_altivec_vmuleuh(__a, __b);
  4822. #else
  4823. return __builtin_altivec_vmulouh(__a, __b);
  4824. #endif
  4825. }
  4826. /* vec_nand */
  4827. #ifdef __POWER8_VECTOR__
  4828. static __inline__ vector signed char __ATTRS_o_ai
  4829. vec_nand(vector signed char __a, vector signed char __b) {
  4830. return ~(__a & __b);
  4831. }
  4832. static __inline__ vector signed char __ATTRS_o_ai
  4833. vec_nand(vector signed char __a, vector bool char __b) {
  4834. return ~(__a & __b);
  4835. }
  4836. static __inline__ vector signed char __ATTRS_o_ai
  4837. vec_nand(vector bool char __a, vector signed char __b) {
  4838. return ~(__a & __b);
  4839. }
  4840. static __inline__ vector unsigned char __ATTRS_o_ai
  4841. vec_nand(vector unsigned char __a, vector unsigned char __b) {
  4842. return ~(__a & __b);
  4843. }
  4844. static __inline__ vector unsigned char __ATTRS_o_ai
  4845. vec_nand(vector unsigned char __a, vector bool char __b) {
  4846. return ~(__a & __b);
  4847. }
  4848. static __inline__ vector unsigned char __ATTRS_o_ai
  4849. vec_nand(vector bool char __a, vector unsigned char __b) {
  4850. return ~(__a & __b);
  4851. }
  4852. static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
  4853. vector bool char __b) {
  4854. return ~(__a & __b);
  4855. }
  4856. static __inline__ vector signed short __ATTRS_o_ai
  4857. vec_nand(vector signed short __a, vector signed short __b) {
  4858. return ~(__a & __b);
  4859. }
  4860. static __inline__ vector signed short __ATTRS_o_ai
  4861. vec_nand(vector signed short __a, vector bool short __b) {
  4862. return ~(__a & __b);
  4863. }
  4864. static __inline__ vector signed short __ATTRS_o_ai
  4865. vec_nand(vector bool short __a, vector signed short __b) {
  4866. return ~(__a & __b);
  4867. }
  4868. static __inline__ vector unsigned short __ATTRS_o_ai
  4869. vec_nand(vector unsigned short __a, vector unsigned short __b) {
  4870. return ~(__a & __b);
  4871. }
  4872. static __inline__ vector unsigned short __ATTRS_o_ai
  4873. vec_nand(vector unsigned short __a, vector bool short __b) {
  4874. return ~(__a & __b);
  4875. }
  4876. static __inline__ vector bool short __ATTRS_o_ai
  4877. vec_nand(vector bool short __a, vector bool short __b) {
  4878. return ~(__a & __b);
  4879. }
  4880. static __inline__ vector signed int __ATTRS_o_ai
  4881. vec_nand(vector signed int __a, vector signed int __b) {
  4882. return ~(__a & __b);
  4883. }
  4884. static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
  4885. vector bool int __b) {
  4886. return ~(__a & __b);
  4887. }
  4888. static __inline__ vector signed int __ATTRS_o_ai
  4889. vec_nand(vector bool int __a, vector signed int __b) {
  4890. return ~(__a & __b);
  4891. }
  4892. static __inline__ vector unsigned int __ATTRS_o_ai
  4893. vec_nand(vector unsigned int __a, vector unsigned int __b) {
  4894. return ~(__a & __b);
  4895. }
  4896. static __inline__ vector unsigned int __ATTRS_o_ai
  4897. vec_nand(vector unsigned int __a, vector bool int __b) {
  4898. return ~(__a & __b);
  4899. }
  4900. static __inline__ vector unsigned int __ATTRS_o_ai
  4901. vec_nand(vector bool int __a, vector unsigned int __b) {
  4902. return ~(__a & __b);
  4903. }
  4904. static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
  4905. vector bool int __b) {
  4906. return ~(__a & __b);
  4907. }
  4908. static __inline__ vector float __ATTRS_o_ai
  4909. vec_nand(vector float __a, vector float __b) {
  4910. return (vector float)(~((vector unsigned int)__a &
  4911. (vector unsigned int)__b));
  4912. }
  4913. static __inline__ vector signed long long __ATTRS_o_ai
  4914. vec_nand(vector signed long long __a, vector signed long long __b) {
  4915. return ~(__a & __b);
  4916. }
  4917. static __inline__ vector signed long long __ATTRS_o_ai
  4918. vec_nand(vector signed long long __a, vector bool long long __b) {
  4919. return ~(__a & __b);
  4920. }
  4921. static __inline__ vector signed long long __ATTRS_o_ai
  4922. vec_nand(vector bool long long __a, vector signed long long __b) {
  4923. return ~(__a & __b);
  4924. }
  4925. static __inline__ vector unsigned long long __ATTRS_o_ai
  4926. vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
  4927. return ~(__a & __b);
  4928. }
  4929. static __inline__ vector unsigned long long __ATTRS_o_ai
  4930. vec_nand(vector unsigned long long __a, vector bool long long __b) {
  4931. return ~(__a & __b);
  4932. }
  4933. static __inline__ vector unsigned long long __ATTRS_o_ai
  4934. vec_nand(vector bool long long __a, vector unsigned long long __b) {
  4935. return ~(__a & __b);
  4936. }
  4937. static __inline__ vector bool long long __ATTRS_o_ai
  4938. vec_nand(vector bool long long __a, vector bool long long __b) {
  4939. return ~(__a & __b);
  4940. }
  4941. static __inline__ vector double __ATTRS_o_ai
  4942. vec_nand(vector double __a, vector double __b) {
  4943. return (vector double)(~((vector unsigned long long)__a &
  4944. (vector unsigned long long)__b));
  4945. }
  4946. #endif
  4947. /* vec_nmadd */
  4948. #ifdef __VSX__
  4949. static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
  4950. vector float __b,
  4951. vector float __c) {
  4952. return __builtin_vsx_xvnmaddasp(__a, __b, __c);
  4953. }
  4954. static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
  4955. vector double __b,
  4956. vector double __c) {
  4957. return __builtin_vsx_xvnmaddadp(__a, __b, __c);
  4958. }
  4959. #endif
  4960. /* vec_nmsub */
  4961. static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
  4962. vector float __b,
  4963. vector float __c) {
  4964. #ifdef __VSX__
  4965. return __builtin_vsx_xvnmsubasp(__a, __b, __c);
  4966. #else
  4967. return __builtin_altivec_vnmsubfp(__a, __b, __c);
  4968. #endif
  4969. }
  4970. #ifdef __VSX__
  4971. static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
  4972. vector double __b,
  4973. vector double __c) {
  4974. return __builtin_vsx_xvnmsubadp(__a, __b, __c);
  4975. }
  4976. #endif
  4977. /* vec_vnmsubfp */
  4978. static __inline__ vector float __attribute__((__always_inline__))
  4979. vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
  4980. return __builtin_altivec_vnmsubfp(__a, __b, __c);
  4981. }
  4982. /* vec_nor */
  4983. #define __builtin_altivec_vnor vec_nor
  4984. static __inline__ vector signed char __ATTRS_o_ai
  4985. vec_nor(vector signed char __a, vector signed char __b) {
  4986. return ~(__a | __b);
  4987. }
  4988. static __inline__ vector unsigned char __ATTRS_o_ai
  4989. vec_nor(vector unsigned char __a, vector unsigned char __b) {
  4990. return ~(__a | __b);
  4991. }
  4992. static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
  4993. vector bool char __b) {
  4994. return ~(__a | __b);
  4995. }
  4996. static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
  4997. vector short __b) {
  4998. return ~(__a | __b);
  4999. }
  5000. static __inline__ vector unsigned short __ATTRS_o_ai
  5001. vec_nor(vector unsigned short __a, vector unsigned short __b) {
  5002. return ~(__a | __b);
  5003. }
  5004. static __inline__ vector bool short __ATTRS_o_ai
  5005. vec_nor(vector bool short __a, vector bool short __b) {
  5006. return ~(__a | __b);
  5007. }
  5008. static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
  5009. vector int __b) {
  5010. return ~(__a | __b);
  5011. }
  5012. static __inline__ vector unsigned int __ATTRS_o_ai
  5013. vec_nor(vector unsigned int __a, vector unsigned int __b) {
  5014. return ~(__a | __b);
  5015. }
  5016. static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
  5017. vector bool int __b) {
  5018. return ~(__a | __b);
  5019. }
  5020. static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
  5021. vector float __b) {
  5022. vector unsigned int __res =
  5023. ~((vector unsigned int)__a | (vector unsigned int)__b);
  5024. return (vector float)__res;
  5025. }
  5026. #ifdef __VSX__
  5027. static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
  5028. vector double __b) {
  5029. vector unsigned long long __res =
  5030. ~((vector unsigned long long)__a | (vector unsigned long long)__b);
  5031. return (vector double)__res;
  5032. }
  5033. #endif
  5034. /* vec_vnor */
  5035. static __inline__ vector signed char __ATTRS_o_ai
  5036. vec_vnor(vector signed char __a, vector signed char __b) {
  5037. return ~(__a | __b);
  5038. }
  5039. static __inline__ vector unsigned char __ATTRS_o_ai
  5040. vec_vnor(vector unsigned char __a, vector unsigned char __b) {
  5041. return ~(__a | __b);
  5042. }
  5043. static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
  5044. vector bool char __b) {
  5045. return ~(__a | __b);
  5046. }
  5047. static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
  5048. vector short __b) {
  5049. return ~(__a | __b);
  5050. }
  5051. static __inline__ vector unsigned short __ATTRS_o_ai
  5052. vec_vnor(vector unsigned short __a, vector unsigned short __b) {
  5053. return ~(__a | __b);
  5054. }
  5055. static __inline__ vector bool short __ATTRS_o_ai
  5056. vec_vnor(vector bool short __a, vector bool short __b) {
  5057. return ~(__a | __b);
  5058. }
  5059. static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
  5060. vector int __b) {
  5061. return ~(__a | __b);
  5062. }
  5063. static __inline__ vector unsigned int __ATTRS_o_ai
  5064. vec_vnor(vector unsigned int __a, vector unsigned int __b) {
  5065. return ~(__a | __b);
  5066. }
  5067. static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
  5068. vector bool int __b) {
  5069. return ~(__a | __b);
  5070. }
  5071. static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
  5072. vector float __b) {
  5073. vector unsigned int __res =
  5074. ~((vector unsigned int)__a | (vector unsigned int)__b);
  5075. return (vector float)__res;
  5076. }
  5077. #ifdef __VSX__
  5078. static __inline__ vector signed long long __ATTRS_o_ai
  5079. vec_nor(vector signed long long __a, vector signed long long __b) {
  5080. return ~(__a | __b);
  5081. }
  5082. static __inline__ vector unsigned long long __ATTRS_o_ai
  5083. vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
  5084. return ~(__a | __b);
  5085. }
  5086. static __inline__ vector bool long long __ATTRS_o_ai
  5087. vec_nor(vector bool long long __a, vector bool long long __b) {
  5088. return ~(__a | __b);
  5089. }
  5090. #endif
  5091. /* vec_or */
  5092. #define __builtin_altivec_vor vec_or
  5093. static __inline__ vector signed char __ATTRS_o_ai
  5094. vec_or(vector signed char __a, vector signed char __b) {
  5095. return __a | __b;
  5096. }
  5097. static __inline__ vector signed char __ATTRS_o_ai
  5098. vec_or(vector bool char __a, vector signed char __b) {
  5099. return (vector signed char)__a | __b;
  5100. }
  5101. static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
  5102. vector bool char __b) {
  5103. return __a | (vector signed char)__b;
  5104. }
  5105. static __inline__ vector unsigned char __ATTRS_o_ai
  5106. vec_or(vector unsigned char __a, vector unsigned char __b) {
  5107. return __a | __b;
  5108. }
  5109. static __inline__ vector unsigned char __ATTRS_o_ai
  5110. vec_or(vector bool char __a, vector unsigned char __b) {
  5111. return (vector unsigned char)__a | __b;
  5112. }
  5113. static __inline__ vector unsigned char __ATTRS_o_ai
  5114. vec_or(vector unsigned char __a, vector bool char __b) {
  5115. return __a | (vector unsigned char)__b;
  5116. }
  5117. static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
  5118. vector bool char __b) {
  5119. return __a | __b;
  5120. }
  5121. static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
  5122. vector short __b) {
  5123. return __a | __b;
  5124. }
  5125. static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
  5126. vector short __b) {
  5127. return (vector short)__a | __b;
  5128. }
  5129. static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
  5130. vector bool short __b) {
  5131. return __a | (vector short)__b;
  5132. }
  5133. static __inline__ vector unsigned short __ATTRS_o_ai
  5134. vec_or(vector unsigned short __a, vector unsigned short __b) {
  5135. return __a | __b;
  5136. }
  5137. static __inline__ vector unsigned short __ATTRS_o_ai
  5138. vec_or(vector bool short __a, vector unsigned short __b) {
  5139. return (vector unsigned short)__a | __b;
  5140. }
  5141. static __inline__ vector unsigned short __ATTRS_o_ai
  5142. vec_or(vector unsigned short __a, vector bool short __b) {
  5143. return __a | (vector unsigned short)__b;
  5144. }
  5145. static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
  5146. vector bool short __b) {
  5147. return __a | __b;
  5148. }
  5149. static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
  5150. vector int __b) {
  5151. return __a | __b;
  5152. }
  5153. static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
  5154. vector int __b) {
  5155. return (vector int)__a | __b;
  5156. }
  5157. static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
  5158. vector bool int __b) {
  5159. return __a | (vector int)__b;
  5160. }
  5161. static __inline__ vector unsigned int __ATTRS_o_ai
  5162. vec_or(vector unsigned int __a, vector unsigned int __b) {
  5163. return __a | __b;
  5164. }
  5165. static __inline__ vector unsigned int __ATTRS_o_ai
  5166. vec_or(vector bool int __a, vector unsigned int __b) {
  5167. return (vector unsigned int)__a | __b;
  5168. }
  5169. static __inline__ vector unsigned int __ATTRS_o_ai
  5170. vec_or(vector unsigned int __a, vector bool int __b) {
  5171. return __a | (vector unsigned int)__b;
  5172. }
  5173. static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
  5174. vector bool int __b) {
  5175. return __a | __b;
  5176. }
  5177. static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
  5178. vector float __b) {
  5179. vector unsigned int __res =
  5180. (vector unsigned int)__a | (vector unsigned int)__b;
  5181. return (vector float)__res;
  5182. }
  5183. static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
  5184. vector float __b) {
  5185. vector unsigned int __res =
  5186. (vector unsigned int)__a | (vector unsigned int)__b;
  5187. return (vector float)__res;
  5188. }
  5189. static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
  5190. vector bool int __b) {
  5191. vector unsigned int __res =
  5192. (vector unsigned int)__a | (vector unsigned int)__b;
  5193. return (vector float)__res;
  5194. }
  5195. #ifdef __VSX__
  5196. static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
  5197. vector double __b) {
  5198. return (vector unsigned long long)__a | (vector unsigned long long)__b;
  5199. }
  5200. static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
  5201. vector bool long long __b) {
  5202. return (vector unsigned long long)__a | (vector unsigned long long)__b;
  5203. }
  5204. static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
  5205. vector double __b) {
  5206. vector unsigned long long __res =
  5207. (vector unsigned long long)__a | (vector unsigned long long)__b;
  5208. return (vector double)__res;
  5209. }
  5210. static __inline__ vector signed long long __ATTRS_o_ai
  5211. vec_or(vector signed long long __a, vector signed long long __b) {
  5212. return __a | __b;
  5213. }
  5214. static __inline__ vector signed long long __ATTRS_o_ai
  5215. vec_or(vector bool long long __a, vector signed long long __b) {
  5216. return (vector signed long long)__a | __b;
  5217. }
  5218. static __inline__ vector signed long long __ATTRS_o_ai
  5219. vec_or(vector signed long long __a, vector bool long long __b) {
  5220. return __a | (vector signed long long)__b;
  5221. }
  5222. static __inline__ vector unsigned long long __ATTRS_o_ai
  5223. vec_or(vector unsigned long long __a, vector unsigned long long __b) {
  5224. return __a | __b;
  5225. }
  5226. static __inline__ vector unsigned long long __ATTRS_o_ai
  5227. vec_or(vector bool long long __a, vector unsigned long long __b) {
  5228. return (vector unsigned long long)__a | __b;
  5229. }
  5230. static __inline__ vector unsigned long long __ATTRS_o_ai
  5231. vec_or(vector unsigned long long __a, vector bool long long __b) {
  5232. return __a | (vector unsigned long long)__b;
  5233. }
  5234. static __inline__ vector bool long long __ATTRS_o_ai
  5235. vec_or(vector bool long long __a, vector bool long long __b) {
  5236. return __a | __b;
  5237. }
  5238. #endif
  5239. #ifdef __POWER8_VECTOR__
  5240. static __inline__ vector signed char __ATTRS_o_ai
  5241. vec_orc(vector signed char __a, vector signed char __b) {
  5242. return __a | ~__b;
  5243. }
  5244. static __inline__ vector signed char __ATTRS_o_ai
  5245. vec_orc(vector signed char __a, vector bool char __b) {
  5246. return __a | ~__b;
  5247. }
  5248. static __inline__ vector signed char __ATTRS_o_ai
  5249. vec_orc(vector bool char __a, vector signed char __b) {
  5250. return __a | ~__b;
  5251. }
  5252. static __inline__ vector unsigned char __ATTRS_o_ai
  5253. vec_orc(vector unsigned char __a, vector unsigned char __b) {
  5254. return __a | ~__b;
  5255. }
  5256. static __inline__ vector unsigned char __ATTRS_o_ai
  5257. vec_orc(vector unsigned char __a, vector bool char __b) {
  5258. return __a | ~__b;
  5259. }
  5260. static __inline__ vector unsigned char __ATTRS_o_ai
  5261. vec_orc(vector bool char __a, vector unsigned char __b) {
  5262. return __a | ~__b;
  5263. }
  5264. static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
  5265. vector bool char __b) {
  5266. return __a | ~__b;
  5267. }
  5268. static __inline__ vector signed short __ATTRS_o_ai
  5269. vec_orc(vector signed short __a, vector signed short __b) {
  5270. return __a | ~__b;
  5271. }
  5272. static __inline__ vector signed short __ATTRS_o_ai
  5273. vec_orc(vector signed short __a, vector bool short __b) {
  5274. return __a | ~__b;
  5275. }
  5276. static __inline__ vector signed short __ATTRS_o_ai
  5277. vec_orc(vector bool short __a, vector signed short __b) {
  5278. return __a | ~__b;
  5279. }
  5280. static __inline__ vector unsigned short __ATTRS_o_ai
  5281. vec_orc(vector unsigned short __a, vector unsigned short __b) {
  5282. return __a | ~__b;
  5283. }
  5284. static __inline__ vector unsigned short __ATTRS_o_ai
  5285. vec_orc(vector unsigned short __a, vector bool short __b) {
  5286. return __a | ~__b;
  5287. }
  5288. static __inline__ vector unsigned short __ATTRS_o_ai
  5289. vec_orc(vector bool short __a, vector unsigned short __b) {
  5290. return __a | ~__b;
  5291. }
  5292. static __inline__ vector bool short __ATTRS_o_ai
  5293. vec_orc(vector bool short __a, vector bool short __b) {
  5294. return __a | ~__b;
  5295. }
  5296. static __inline__ vector signed int __ATTRS_o_ai
  5297. vec_orc(vector signed int __a, vector signed int __b) {
  5298. return __a | ~__b;
  5299. }
  5300. static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
  5301. vector bool int __b) {
  5302. return __a | ~__b;
  5303. }
  5304. static __inline__ vector signed int __ATTRS_o_ai
  5305. vec_orc(vector bool int __a, vector signed int __b) {
  5306. return __a | ~__b;
  5307. }
  5308. static __inline__ vector unsigned int __ATTRS_o_ai
  5309. vec_orc(vector unsigned int __a, vector unsigned int __b) {
  5310. return __a | ~__b;
  5311. }
  5312. static __inline__ vector unsigned int __ATTRS_o_ai
  5313. vec_orc(vector unsigned int __a, vector bool int __b) {
  5314. return __a | ~__b;
  5315. }
  5316. static __inline__ vector unsigned int __ATTRS_o_ai
  5317. vec_orc(vector bool int __a, vector unsigned int __b) {
  5318. return __a | ~__b;
  5319. }
  5320. static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
  5321. vector bool int __b) {
  5322. return __a | ~__b;
  5323. }
  5324. static __inline__ vector float __ATTRS_o_ai
  5325. vec_orc(vector bool int __a, vector float __b) {
  5326. return (vector float)(__a | ~(vector unsigned int)__b);
  5327. }
  5328. static __inline__ vector float __ATTRS_o_ai
  5329. vec_orc(vector float __a, vector bool int __b) {
  5330. return (vector float)((vector unsigned int)__a | ~__b);
  5331. }
  5332. static __inline__ vector signed long long __ATTRS_o_ai
  5333. vec_orc(vector signed long long __a, vector signed long long __b) {
  5334. return __a | ~__b;
  5335. }
  5336. static __inline__ vector signed long long __ATTRS_o_ai
  5337. vec_orc(vector signed long long __a, vector bool long long __b) {
  5338. return __a | ~__b;
  5339. }
  5340. static __inline__ vector signed long long __ATTRS_o_ai
  5341. vec_orc(vector bool long long __a, vector signed long long __b) {
  5342. return __a | ~__b;
  5343. }
  5344. static __inline__ vector unsigned long long __ATTRS_o_ai
  5345. vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
  5346. return __a | ~__b;
  5347. }
  5348. static __inline__ vector unsigned long long __ATTRS_o_ai
  5349. vec_orc(vector unsigned long long __a, vector bool long long __b) {
  5350. return __a | ~__b;
  5351. }
  5352. static __inline__ vector unsigned long long __ATTRS_o_ai
  5353. vec_orc(vector bool long long __a, vector unsigned long long __b) {
  5354. return __a | ~__b;
  5355. }
  5356. static __inline__ vector bool long long __ATTRS_o_ai
  5357. vec_orc(vector bool long long __a, vector bool long long __b) {
  5358. return __a | ~__b;
  5359. }
  5360. static __inline__ vector double __ATTRS_o_ai
  5361. vec_orc(vector double __a, vector bool long long __b) {
  5362. return (vector double)((vector unsigned long long)__a | ~__b);
  5363. }
  5364. static __inline__ vector double __ATTRS_o_ai
  5365. vec_orc(vector bool long long __a, vector double __b) {
  5366. return (vector double)(__a | ~(vector unsigned long long)__b);
  5367. }
  5368. #endif
  5369. /* vec_vor */
  5370. static __inline__ vector signed char __ATTRS_o_ai
  5371. vec_vor(vector signed char __a, vector signed char __b) {
  5372. return __a | __b;
  5373. }
  5374. static __inline__ vector signed char __ATTRS_o_ai
  5375. vec_vor(vector bool char __a, vector signed char __b) {
  5376. return (vector signed char)__a | __b;
  5377. }
  5378. static __inline__ vector signed char __ATTRS_o_ai
  5379. vec_vor(vector signed char __a, vector bool char __b) {
  5380. return __a | (vector signed char)__b;
  5381. }
  5382. static __inline__ vector unsigned char __ATTRS_o_ai
  5383. vec_vor(vector unsigned char __a, vector unsigned char __b) {
  5384. return __a | __b;
  5385. }
  5386. static __inline__ vector unsigned char __ATTRS_o_ai
  5387. vec_vor(vector bool char __a, vector unsigned char __b) {
  5388. return (vector unsigned char)__a | __b;
  5389. }
  5390. static __inline__ vector unsigned char __ATTRS_o_ai
  5391. vec_vor(vector unsigned char __a, vector bool char __b) {
  5392. return __a | (vector unsigned char)__b;
  5393. }
  5394. static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
  5395. vector bool char __b) {
  5396. return __a | __b;
  5397. }
  5398. static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
  5399. vector short __b) {
  5400. return __a | __b;
  5401. }
  5402. static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
  5403. vector short __b) {
  5404. return (vector short)__a | __b;
  5405. }
  5406. static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
  5407. vector bool short __b) {
  5408. return __a | (vector short)__b;
  5409. }
  5410. static __inline__ vector unsigned short __ATTRS_o_ai
  5411. vec_vor(vector unsigned short __a, vector unsigned short __b) {
  5412. return __a | __b;
  5413. }
  5414. static __inline__ vector unsigned short __ATTRS_o_ai
  5415. vec_vor(vector bool short __a, vector unsigned short __b) {
  5416. return (vector unsigned short)__a | __b;
  5417. }
  5418. static __inline__ vector unsigned short __ATTRS_o_ai
  5419. vec_vor(vector unsigned short __a, vector bool short __b) {
  5420. return __a | (vector unsigned short)__b;
  5421. }
  5422. static __inline__ vector bool short __ATTRS_o_ai
  5423. vec_vor(vector bool short __a, vector bool short __b) {
  5424. return __a | __b;
  5425. }
  5426. static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
  5427. vector int __b) {
  5428. return __a | __b;
  5429. }
  5430. static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
  5431. vector int __b) {
  5432. return (vector int)__a | __b;
  5433. }
  5434. static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
  5435. vector bool int __b) {
  5436. return __a | (vector int)__b;
  5437. }
  5438. static __inline__ vector unsigned int __ATTRS_o_ai
  5439. vec_vor(vector unsigned int __a, vector unsigned int __b) {
  5440. return __a | __b;
  5441. }
  5442. static __inline__ vector unsigned int __ATTRS_o_ai
  5443. vec_vor(vector bool int __a, vector unsigned int __b) {
  5444. return (vector unsigned int)__a | __b;
  5445. }
  5446. static __inline__ vector unsigned int __ATTRS_o_ai
  5447. vec_vor(vector unsigned int __a, vector bool int __b) {
  5448. return __a | (vector unsigned int)__b;
  5449. }
  5450. static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
  5451. vector bool int __b) {
  5452. return __a | __b;
  5453. }
  5454. static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
  5455. vector float __b) {
  5456. vector unsigned int __res =
  5457. (vector unsigned int)__a | (vector unsigned int)__b;
  5458. return (vector float)__res;
  5459. }
  5460. static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
  5461. vector float __b) {
  5462. vector unsigned int __res =
  5463. (vector unsigned int)__a | (vector unsigned int)__b;
  5464. return (vector float)__res;
  5465. }
  5466. static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
  5467. vector bool int __b) {
  5468. vector unsigned int __res =
  5469. (vector unsigned int)__a | (vector unsigned int)__b;
  5470. return (vector float)__res;
  5471. }
  5472. #ifdef __VSX__
  5473. static __inline__ vector signed long long __ATTRS_o_ai
  5474. vec_vor(vector signed long long __a, vector signed long long __b) {
  5475. return __a | __b;
  5476. }
  5477. static __inline__ vector signed long long __ATTRS_o_ai
  5478. vec_vor(vector bool long long __a, vector signed long long __b) {
  5479. return (vector signed long long)__a | __b;
  5480. }
  5481. static __inline__ vector signed long long __ATTRS_o_ai
  5482. vec_vor(vector signed long long __a, vector bool long long __b) {
  5483. return __a | (vector signed long long)__b;
  5484. }
  5485. static __inline__ vector unsigned long long __ATTRS_o_ai
  5486. vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
  5487. return __a | __b;
  5488. }
  5489. static __inline__ vector unsigned long long __ATTRS_o_ai
  5490. vec_vor(vector bool long long __a, vector unsigned long long __b) {
  5491. return (vector unsigned long long)__a | __b;
  5492. }
  5493. static __inline__ vector unsigned long long __ATTRS_o_ai
  5494. vec_vor(vector unsigned long long __a, vector bool long long __b) {
  5495. return __a | (vector unsigned long long)__b;
  5496. }
  5497. static __inline__ vector bool long long __ATTRS_o_ai
  5498. vec_vor(vector bool long long __a, vector bool long long __b) {
  5499. return __a | __b;
  5500. }
  5501. #endif
  5502. /* vec_pack */
  5503. /* The various vector pack instructions have a big-endian bias, so for
  5504. little endian we must handle reversed element numbering. */
  5505. static __inline__ vector signed char __ATTRS_o_ai
  5506. vec_pack(vector signed short __a, vector signed short __b) {
  5507. #ifdef __LITTLE_ENDIAN__
  5508. return (vector signed char)vec_perm(
  5509. __a, __b,
  5510. (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
  5511. 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
  5512. #else
  5513. return (vector signed char)vec_perm(
  5514. __a, __b,
  5515. (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
  5516. 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
  5517. #endif
  5518. }
  5519. static __inline__ vector unsigned char __ATTRS_o_ai
  5520. vec_pack(vector unsigned short __a, vector unsigned short __b) {
  5521. #ifdef __LITTLE_ENDIAN__
  5522. return (vector unsigned char)vec_perm(
  5523. __a, __b,
  5524. (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
  5525. 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
  5526. #else
  5527. return (vector unsigned char)vec_perm(
  5528. __a, __b,
  5529. (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
  5530. 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
  5531. #endif
  5532. }
  5533. static __inline__ vector bool char __ATTRS_o_ai
  5534. vec_pack(vector bool short __a, vector bool short __b) {
  5535. #ifdef __LITTLE_ENDIAN__
  5536. return (vector bool char)vec_perm(
  5537. __a, __b,
  5538. (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
  5539. 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
  5540. #else
  5541. return (vector bool char)vec_perm(
  5542. __a, __b,
  5543. (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
  5544. 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
  5545. #endif
  5546. }
  5547. static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
  5548. vector int __b) {
  5549. #ifdef __LITTLE_ENDIAN__
  5550. return (vector short)vec_perm(
  5551. __a, __b,
  5552. (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
  5553. 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
  5554. #else
  5555. return (vector short)vec_perm(
  5556. __a, __b,
  5557. (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
  5558. 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
  5559. #endif
  5560. }
  5561. static __inline__ vector unsigned short __ATTRS_o_ai
  5562. vec_pack(vector unsigned int __a, vector unsigned int __b) {
  5563. #ifdef __LITTLE_ENDIAN__
  5564. return (vector unsigned short)vec_perm(
  5565. __a, __b,
  5566. (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
  5567. 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
  5568. #else
  5569. return (vector unsigned short)vec_perm(
  5570. __a, __b,
  5571. (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
  5572. 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
  5573. #endif
  5574. }
  5575. static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
  5576. vector bool int __b) {
  5577. #ifdef __LITTLE_ENDIAN__
  5578. return (vector bool short)vec_perm(
  5579. __a, __b,
  5580. (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
  5581. 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
  5582. #else
  5583. return (vector bool short)vec_perm(
  5584. __a, __b,
  5585. (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
  5586. 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
  5587. #endif
  5588. }
  5589. #ifdef __VSX__
  5590. static __inline__ vector signed int __ATTRS_o_ai
  5591. vec_pack(vector signed long long __a, vector signed long long __b) {
  5592. #ifdef __LITTLE_ENDIAN__
  5593. return (vector signed int)vec_perm(
  5594. __a, __b,
  5595. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
  5596. 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
  5597. #else
  5598. return (vector signed int)vec_perm(
  5599. __a, __b,
  5600. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
  5601. 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
  5602. #endif
  5603. }
  5604. static __inline__ vector unsigned int __ATTRS_o_ai
  5605. vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
  5606. #ifdef __LITTLE_ENDIAN__
  5607. return (vector unsigned int)vec_perm(
  5608. __a, __b,
  5609. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
  5610. 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
  5611. #else
  5612. return (vector unsigned int)vec_perm(
  5613. __a, __b,
  5614. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
  5615. 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
  5616. #endif
  5617. }
  5618. static __inline__ vector bool int __ATTRS_o_ai
  5619. vec_pack(vector bool long long __a, vector bool long long __b) {
  5620. #ifdef __LITTLE_ENDIAN__
  5621. return (vector bool int)vec_perm(
  5622. __a, __b,
  5623. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
  5624. 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
  5625. #else
  5626. return (vector bool int)vec_perm(
  5627. __a, __b,
  5628. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
  5629. 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
  5630. #endif
  5631. }
  5632. static __inline__ vector float __ATTRS_o_ai
  5633. vec_pack(vector double __a, vector double __b) {
  5634. return (vector float) (__a[0], __a[1], __b[0], __b[1]);
  5635. }
  5636. #endif
  5637. #ifdef __POWER9_VECTOR__
  5638. static __inline__ vector unsigned short __ATTRS_o_ai
  5639. vec_pack_to_short_fp32(vector float __a, vector float __b) {
  5640. vector float __resa = __builtin_vsx_xvcvsphp(__a);
  5641. vector float __resb = __builtin_vsx_xvcvsphp(__b);
  5642. #ifdef __LITTLE_ENDIAN__
  5643. return (vector unsigned short)vec_mergee(__resa, __resb);
  5644. #else
  5645. return (vector unsigned short)vec_mergeo(__resa, __resb);
  5646. #endif
  5647. }
  5648. #endif
  5649. /* vec_vpkuhum */
  5650. #define __builtin_altivec_vpkuhum vec_vpkuhum
  5651. static __inline__ vector signed char __ATTRS_o_ai
  5652. vec_vpkuhum(vector signed short __a, vector signed short __b) {
  5653. #ifdef __LITTLE_ENDIAN__
  5654. return (vector signed char)vec_perm(
  5655. __a, __b,
  5656. (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
  5657. 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
  5658. #else
  5659. return (vector signed char)vec_perm(
  5660. __a, __b,
  5661. (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
  5662. 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
  5663. #endif
  5664. }
  5665. static __inline__ vector unsigned char __ATTRS_o_ai
  5666. vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
  5667. #ifdef __LITTLE_ENDIAN__
  5668. return (vector unsigned char)vec_perm(
  5669. __a, __b,
  5670. (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
  5671. 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
  5672. #else
  5673. return (vector unsigned char)vec_perm(
  5674. __a, __b,
  5675. (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
  5676. 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
  5677. #endif
  5678. }
  5679. static __inline__ vector bool char __ATTRS_o_ai
  5680. vec_vpkuhum(vector bool short __a, vector bool short __b) {
  5681. #ifdef __LITTLE_ENDIAN__
  5682. return (vector bool char)vec_perm(
  5683. __a, __b,
  5684. (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
  5685. 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
  5686. #else
  5687. return (vector bool char)vec_perm(
  5688. __a, __b,
  5689. (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
  5690. 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
  5691. #endif
  5692. }
  5693. /* vec_vpkuwum */
  5694. #define __builtin_altivec_vpkuwum vec_vpkuwum
  5695. static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
  5696. vector int __b) {
  5697. #ifdef __LITTLE_ENDIAN__
  5698. return (vector short)vec_perm(
  5699. __a, __b,
  5700. (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
  5701. 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
  5702. #else
  5703. return (vector short)vec_perm(
  5704. __a, __b,
  5705. (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
  5706. 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
  5707. #endif
  5708. }
  5709. static __inline__ vector unsigned short __ATTRS_o_ai
  5710. vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
  5711. #ifdef __LITTLE_ENDIAN__
  5712. return (vector unsigned short)vec_perm(
  5713. __a, __b,
  5714. (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
  5715. 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
  5716. #else
  5717. return (vector unsigned short)vec_perm(
  5718. __a, __b,
  5719. (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
  5720. 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
  5721. #endif
  5722. }
  5723. static __inline__ vector bool short __ATTRS_o_ai
  5724. vec_vpkuwum(vector bool int __a, vector bool int __b) {
  5725. #ifdef __LITTLE_ENDIAN__
  5726. return (vector bool short)vec_perm(
  5727. __a, __b,
  5728. (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
  5729. 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
  5730. #else
  5731. return (vector bool short)vec_perm(
  5732. __a, __b,
  5733. (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
  5734. 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
  5735. #endif
  5736. }
  5737. /* vec_vpkudum */
  5738. #ifdef __POWER8_VECTOR__
  5739. #define __builtin_altivec_vpkudum vec_vpkudum
  5740. static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
  5741. vector long long __b) {
  5742. #ifdef __LITTLE_ENDIAN__
  5743. return (vector int)vec_perm(
  5744. __a, __b,
  5745. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
  5746. 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
  5747. #else
  5748. return (vector int)vec_perm(
  5749. __a, __b,
  5750. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
  5751. 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
  5752. #endif
  5753. }
  5754. static __inline__ vector unsigned int __ATTRS_o_ai
  5755. vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
  5756. #ifdef __LITTLE_ENDIAN__
  5757. return (vector unsigned int)vec_perm(
  5758. __a, __b,
  5759. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
  5760. 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
  5761. #else
  5762. return (vector unsigned int)vec_perm(
  5763. __a, __b,
  5764. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
  5765. 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
  5766. #endif
  5767. }
  5768. static __inline__ vector bool int __ATTRS_o_ai
  5769. vec_vpkudum(vector bool long long __a, vector bool long long __b) {
  5770. #ifdef __LITTLE_ENDIAN__
  5771. return (vector bool int)vec_perm(
  5772. (vector long long)__a, (vector long long)__b,
  5773. (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
  5774. 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
  5775. #else
  5776. return (vector bool int)vec_perm(
  5777. (vector long long)__a, (vector long long)__b,
  5778. (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
  5779. 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
  5780. #endif
  5781. }
  5782. #endif
  5783. /* vec_packpx */
  5784. static __inline__ vector pixel __attribute__((__always_inline__))
  5785. vec_packpx(vector unsigned int __a, vector unsigned int __b) {
  5786. #ifdef __LITTLE_ENDIAN__
  5787. return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
  5788. #else
  5789. return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
  5790. #endif
  5791. }
  5792. /* vec_vpkpx */
  5793. static __inline__ vector pixel __attribute__((__always_inline__))
  5794. vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
  5795. #ifdef __LITTLE_ENDIAN__
  5796. return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
  5797. #else
  5798. return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
  5799. #endif
  5800. }
  5801. /* vec_packs */
  5802. static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
  5803. vector short __b) {
  5804. #ifdef __LITTLE_ENDIAN__
  5805. return __builtin_altivec_vpkshss(__b, __a);
  5806. #else
  5807. return __builtin_altivec_vpkshss(__a, __b);
  5808. #endif
  5809. }
  5810. static __inline__ vector unsigned char __ATTRS_o_ai
  5811. vec_packs(vector unsigned short __a, vector unsigned short __b) {
  5812. #ifdef __LITTLE_ENDIAN__
  5813. return __builtin_altivec_vpkuhus(__b, __a);
  5814. #else
  5815. return __builtin_altivec_vpkuhus(__a, __b);
  5816. #endif
  5817. }
  5818. static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
  5819. vector int __b) {
  5820. #ifdef __LITTLE_ENDIAN__
  5821. return __builtin_altivec_vpkswss(__b, __a);
  5822. #else
  5823. return __builtin_altivec_vpkswss(__a, __b);
  5824. #endif
  5825. }
  5826. static __inline__ vector unsigned short __ATTRS_o_ai
  5827. vec_packs(vector unsigned int __a, vector unsigned int __b) {
  5828. #ifdef __LITTLE_ENDIAN__
  5829. return __builtin_altivec_vpkuwus(__b, __a);
  5830. #else
  5831. return __builtin_altivec_vpkuwus(__a, __b);
  5832. #endif
  5833. }
  5834. #ifdef __POWER8_VECTOR__
  5835. static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
  5836. vector long long __b) {
  5837. #ifdef __LITTLE_ENDIAN__
  5838. return __builtin_altivec_vpksdss(__b, __a);
  5839. #else
  5840. return __builtin_altivec_vpksdss(__a, __b);
  5841. #endif
  5842. }
  5843. static __inline__ vector unsigned int __ATTRS_o_ai
  5844. vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
  5845. #ifdef __LITTLE_ENDIAN__
  5846. return __builtin_altivec_vpkudus(__b, __a);
  5847. #else
  5848. return __builtin_altivec_vpkudus(__a, __b);
  5849. #endif
  5850. }
  5851. #endif
  5852. /* vec_vpkshss */
  5853. static __inline__ vector signed char __attribute__((__always_inline__))
  5854. vec_vpkshss(vector short __a, vector short __b) {
  5855. #ifdef __LITTLE_ENDIAN__
  5856. return __builtin_altivec_vpkshss(__b, __a);
  5857. #else
  5858. return __builtin_altivec_vpkshss(__a, __b);
  5859. #endif
  5860. }
  5861. /* vec_vpksdss */
  5862. #ifdef __POWER8_VECTOR__
  5863. static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
  5864. vector long long __b) {
  5865. #ifdef __LITTLE_ENDIAN__
  5866. return __builtin_altivec_vpksdss(__b, __a);
  5867. #else
  5868. return __builtin_altivec_vpksdss(__a, __b);
  5869. #endif
  5870. }
  5871. #endif
  5872. /* vec_vpkuhus */
  5873. static __inline__ vector unsigned char __attribute__((__always_inline__))
  5874. vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
  5875. #ifdef __LITTLE_ENDIAN__
  5876. return __builtin_altivec_vpkuhus(__b, __a);
  5877. #else
  5878. return __builtin_altivec_vpkuhus(__a, __b);
  5879. #endif
  5880. }
  5881. /* vec_vpkudus */
  5882. #ifdef __POWER8_VECTOR__
  5883. static __inline__ vector unsigned int __attribute__((__always_inline__))
  5884. vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
  5885. #ifdef __LITTLE_ENDIAN__
  5886. return __builtin_altivec_vpkudus(__b, __a);
  5887. #else
  5888. return __builtin_altivec_vpkudus(__a, __b);
  5889. #endif
  5890. }
  5891. #endif
  5892. /* vec_vpkswss */
  5893. static __inline__ vector signed short __attribute__((__always_inline__))
  5894. vec_vpkswss(vector int __a, vector int __b) {
  5895. #ifdef __LITTLE_ENDIAN__
  5896. return __builtin_altivec_vpkswss(__b, __a);
  5897. #else
  5898. return __builtin_altivec_vpkswss(__a, __b);
  5899. #endif
  5900. }
  5901. /* vec_vpkuwus */
  5902. static __inline__ vector unsigned short __attribute__((__always_inline__))
  5903. vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
  5904. #ifdef __LITTLE_ENDIAN__
  5905. return __builtin_altivec_vpkuwus(__b, __a);
  5906. #else
  5907. return __builtin_altivec_vpkuwus(__a, __b);
  5908. #endif
  5909. }
  5910. /* vec_packsu */
  5911. static __inline__ vector unsigned char __ATTRS_o_ai
  5912. vec_packsu(vector short __a, vector short __b) {
  5913. #ifdef __LITTLE_ENDIAN__
  5914. return __builtin_altivec_vpkshus(__b, __a);
  5915. #else
  5916. return __builtin_altivec_vpkshus(__a, __b);
  5917. #endif
  5918. }
  5919. static __inline__ vector unsigned char __ATTRS_o_ai
  5920. vec_packsu(vector unsigned short __a, vector unsigned short __b) {
  5921. #ifdef __LITTLE_ENDIAN__
  5922. return __builtin_altivec_vpkuhus(__b, __a);
  5923. #else
  5924. return __builtin_altivec_vpkuhus(__a, __b);
  5925. #endif
  5926. }
  5927. static __inline__ vector unsigned short __ATTRS_o_ai
  5928. vec_packsu(vector int __a, vector int __b) {
  5929. #ifdef __LITTLE_ENDIAN__
  5930. return __builtin_altivec_vpkswus(__b, __a);
  5931. #else
  5932. return __builtin_altivec_vpkswus(__a, __b);
  5933. #endif
  5934. }
  5935. static __inline__ vector unsigned short __ATTRS_o_ai
  5936. vec_packsu(vector unsigned int __a, vector unsigned int __b) {
  5937. #ifdef __LITTLE_ENDIAN__
  5938. return __builtin_altivec_vpkuwus(__b, __a);
  5939. #else
  5940. return __builtin_altivec_vpkuwus(__a, __b);
  5941. #endif
  5942. }
  5943. #ifdef __POWER8_VECTOR__
  5944. static __inline__ vector unsigned int __ATTRS_o_ai
  5945. vec_packsu(vector long long __a, vector long long __b) {
  5946. #ifdef __LITTLE_ENDIAN__
  5947. return __builtin_altivec_vpksdus(__b, __a);
  5948. #else
  5949. return __builtin_altivec_vpksdus(__a, __b);
  5950. #endif
  5951. }
  5952. static __inline__ vector unsigned int __ATTRS_o_ai
  5953. vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
  5954. #ifdef __LITTLE_ENDIAN__
  5955. return __builtin_altivec_vpkudus(__b, __a);
  5956. #else
  5957. return __builtin_altivec_vpkudus(__a, __b);
  5958. #endif
  5959. }
  5960. #endif
  5961. /* vec_vpkshus */
  5962. static __inline__ vector unsigned char __ATTRS_o_ai
  5963. vec_vpkshus(vector short __a, vector short __b) {
  5964. #ifdef __LITTLE_ENDIAN__
  5965. return __builtin_altivec_vpkshus(__b, __a);
  5966. #else
  5967. return __builtin_altivec_vpkshus(__a, __b);
  5968. #endif
  5969. }
  5970. static __inline__ vector unsigned char __ATTRS_o_ai
  5971. vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
  5972. #ifdef __LITTLE_ENDIAN__
  5973. return __builtin_altivec_vpkuhus(__b, __a);
  5974. #else
  5975. return __builtin_altivec_vpkuhus(__a, __b);
  5976. #endif
  5977. }
  5978. /* vec_vpkswus */
  5979. static __inline__ vector unsigned short __ATTRS_o_ai
  5980. vec_vpkswus(vector int __a, vector int __b) {
  5981. #ifdef __LITTLE_ENDIAN__
  5982. return __builtin_altivec_vpkswus(__b, __a);
  5983. #else
  5984. return __builtin_altivec_vpkswus(__a, __b);
  5985. #endif
  5986. }
  5987. static __inline__ vector unsigned short __ATTRS_o_ai
  5988. vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
  5989. #ifdef __LITTLE_ENDIAN__
  5990. return __builtin_altivec_vpkuwus(__b, __a);
  5991. #else
  5992. return __builtin_altivec_vpkuwus(__a, __b);
  5993. #endif
  5994. }
  5995. /* vec_vpksdus */
  5996. #ifdef __POWER8_VECTOR__
  5997. static __inline__ vector unsigned int __ATTRS_o_ai
  5998. vec_vpksdus(vector long long __a, vector long long __b) {
  5999. #ifdef __LITTLE_ENDIAN__
  6000. return __builtin_altivec_vpksdus(__b, __a);
  6001. #else
  6002. return __builtin_altivec_vpksdus(__a, __b);
  6003. #endif
  6004. }
  6005. #endif
  6006. /* vec_perm */
  6007. // The vperm instruction is defined architecturally with a big-endian bias.
  6008. // For little endian, we swap the input operands and invert the permute
  6009. // control vector. Only the rightmost 5 bits matter, so we could use
  6010. // a vector of all 31s instead of all 255s to perform the inversion.
  6011. // However, when the PCV is not a constant, using 255 has an advantage
  6012. // in that the vec_xor can be recognized as a vec_nor (and for P8 and
  6013. // later, possibly a vec_nand).
  6014. static __inline__ vector signed char __ATTRS_o_ai vec_perm(
  6015. vector signed char __a, vector signed char __b, vector unsigned char __c) {
  6016. #ifdef __LITTLE_ENDIAN__
  6017. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6018. 255, 255, 255, 255, 255, 255, 255, 255};
  6019. __d = vec_xor(__c, __d);
  6020. return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
  6021. (vector int)__a, __d);
  6022. #else
  6023. return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
  6024. (vector int)__b, __c);
  6025. #endif
  6026. }
  6027. static __inline__ vector unsigned char __ATTRS_o_ai
  6028. vec_perm(vector unsigned char __a, vector unsigned char __b,
  6029. vector unsigned char __c) {
  6030. #ifdef __LITTLE_ENDIAN__
  6031. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6032. 255, 255, 255, 255, 255, 255, 255, 255};
  6033. __d = vec_xor(__c, __d);
  6034. return (vector unsigned char)__builtin_altivec_vperm_4si(
  6035. (vector int)__b, (vector int)__a, __d);
  6036. #else
  6037. return (vector unsigned char)__builtin_altivec_vperm_4si(
  6038. (vector int)__a, (vector int)__b, __c);
  6039. #endif
  6040. }
  6041. static __inline__ vector bool char __ATTRS_o_ai
  6042. vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
  6043. #ifdef __LITTLE_ENDIAN__
  6044. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6045. 255, 255, 255, 255, 255, 255, 255, 255};
  6046. __d = vec_xor(__c, __d);
  6047. return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
  6048. (vector int)__a, __d);
  6049. #else
  6050. return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
  6051. (vector int)__b, __c);
  6052. #endif
  6053. }
  6054. static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
  6055. vector signed short __b,
  6056. vector unsigned char __c) {
  6057. #ifdef __LITTLE_ENDIAN__
  6058. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6059. 255, 255, 255, 255, 255, 255, 255, 255};
  6060. __d = vec_xor(__c, __d);
  6061. return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
  6062. (vector int)__a, __d);
  6063. #else
  6064. return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
  6065. (vector int)__b, __c);
  6066. #endif
  6067. }
  6068. static __inline__ vector unsigned short __ATTRS_o_ai
  6069. vec_perm(vector unsigned short __a, vector unsigned short __b,
  6070. vector unsigned char __c) {
  6071. #ifdef __LITTLE_ENDIAN__
  6072. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6073. 255, 255, 255, 255, 255, 255, 255, 255};
  6074. __d = vec_xor(__c, __d);
  6075. return (vector unsigned short)__builtin_altivec_vperm_4si(
  6076. (vector int)__b, (vector int)__a, __d);
  6077. #else
  6078. return (vector unsigned short)__builtin_altivec_vperm_4si(
  6079. (vector int)__a, (vector int)__b, __c);
  6080. #endif
  6081. }
  6082. static __inline__ vector bool short __ATTRS_o_ai vec_perm(
  6083. vector bool short __a, vector bool short __b, vector unsigned char __c) {
  6084. #ifdef __LITTLE_ENDIAN__
  6085. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6086. 255, 255, 255, 255, 255, 255, 255, 255};
  6087. __d = vec_xor(__c, __d);
  6088. return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
  6089. (vector int)__a, __d);
  6090. #else
  6091. return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
  6092. (vector int)__b, __c);
  6093. #endif
  6094. }
  6095. static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
  6096. vector pixel __b,
  6097. vector unsigned char __c) {
  6098. #ifdef __LITTLE_ENDIAN__
  6099. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6100. 255, 255, 255, 255, 255, 255, 255, 255};
  6101. __d = vec_xor(__c, __d);
  6102. return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
  6103. (vector int)__a, __d);
  6104. #else
  6105. return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
  6106. (vector int)__b, __c);
  6107. #endif
  6108. }
  6109. static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
  6110. vector signed int __b,
  6111. vector unsigned char __c) {
  6112. #ifdef __LITTLE_ENDIAN__
  6113. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6114. 255, 255, 255, 255, 255, 255, 255, 255};
  6115. __d = vec_xor(__c, __d);
  6116. return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
  6117. #else
  6118. return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
  6119. #endif
  6120. }
  6121. static __inline__ vector unsigned int __ATTRS_o_ai
  6122. vec_perm(vector unsigned int __a, vector unsigned int __b,
  6123. vector unsigned char __c) {
  6124. #ifdef __LITTLE_ENDIAN__
  6125. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6126. 255, 255, 255, 255, 255, 255, 255, 255};
  6127. __d = vec_xor(__c, __d);
  6128. return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
  6129. (vector int)__a, __d);
  6130. #else
  6131. return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
  6132. (vector int)__b, __c);
  6133. #endif
  6134. }
  6135. static __inline__ vector bool int __ATTRS_o_ai
  6136. vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
  6137. #ifdef __LITTLE_ENDIAN__
  6138. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6139. 255, 255, 255, 255, 255, 255, 255, 255};
  6140. __d = vec_xor(__c, __d);
  6141. return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
  6142. (vector int)__a, __d);
  6143. #else
  6144. return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
  6145. (vector int)__b, __c);
  6146. #endif
  6147. }
  6148. static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
  6149. vector float __b,
  6150. vector unsigned char __c) {
  6151. #ifdef __LITTLE_ENDIAN__
  6152. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6153. 255, 255, 255, 255, 255, 255, 255, 255};
  6154. __d = vec_xor(__c, __d);
  6155. return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
  6156. (vector int)__a, __d);
  6157. #else
  6158. return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
  6159. (vector int)__b, __c);
  6160. #endif
  6161. }
  6162. #ifdef __VSX__
  6163. static __inline__ vector long long __ATTRS_o_ai
  6164. vec_perm(vector signed long long __a, vector signed long long __b,
  6165. vector unsigned char __c) {
  6166. #ifdef __LITTLE_ENDIAN__
  6167. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6168. 255, 255, 255, 255, 255, 255, 255, 255};
  6169. __d = vec_xor(__c, __d);
  6170. return (vector signed long long)__builtin_altivec_vperm_4si(
  6171. (vector int)__b, (vector int)__a, __d);
  6172. #else
  6173. return (vector signed long long)__builtin_altivec_vperm_4si(
  6174. (vector int)__a, (vector int)__b, __c);
  6175. #endif
  6176. }
  6177. static __inline__ vector unsigned long long __ATTRS_o_ai
  6178. vec_perm(vector unsigned long long __a, vector unsigned long long __b,
  6179. vector unsigned char __c) {
  6180. #ifdef __LITTLE_ENDIAN__
  6181. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6182. 255, 255, 255, 255, 255, 255, 255, 255};
  6183. __d = vec_xor(__c, __d);
  6184. return (vector unsigned long long)__builtin_altivec_vperm_4si(
  6185. (vector int)__b, (vector int)__a, __d);
  6186. #else
  6187. return (vector unsigned long long)__builtin_altivec_vperm_4si(
  6188. (vector int)__a, (vector int)__b, __c);
  6189. #endif
  6190. }
  6191. static __inline__ vector bool long long __ATTRS_o_ai
  6192. vec_perm(vector bool long long __a, vector bool long long __b,
  6193. vector unsigned char __c) {
  6194. #ifdef __LITTLE_ENDIAN__
  6195. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6196. 255, 255, 255, 255, 255, 255, 255, 255};
  6197. __d = vec_xor(__c, __d);
  6198. return (vector bool long long)__builtin_altivec_vperm_4si(
  6199. (vector int)__b, (vector int)__a, __d);
  6200. #else
  6201. return (vector bool long long)__builtin_altivec_vperm_4si(
  6202. (vector int)__a, (vector int)__b, __c);
  6203. #endif
  6204. }
  6205. static __inline__ vector double __ATTRS_o_ai
  6206. vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
  6207. #ifdef __LITTLE_ENDIAN__
  6208. vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
  6209. 255, 255, 255, 255, 255, 255, 255, 255};
  6210. __d = vec_xor(__c, __d);
  6211. return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
  6212. (vector int)__a, __d);
  6213. #else
  6214. return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
  6215. (vector int)__b, __c);
  6216. #endif
  6217. }
  6218. #endif
  6219. /* vec_vperm */
  6220. static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
  6221. vector signed char __a, vector signed char __b, vector unsigned char __c) {
  6222. return vec_perm(__a, __b, __c);
  6223. }
  6224. static __inline__ vector unsigned char __ATTRS_o_ai
  6225. vec_vperm(vector unsigned char __a, vector unsigned char __b,
  6226. vector unsigned char __c) {
  6227. return vec_perm(__a, __b, __c);
  6228. }
  6229. static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
  6230. vector bool char __a, vector bool char __b, vector unsigned char __c) {
  6231. return vec_perm(__a, __b, __c);
  6232. }
  6233. static __inline__ vector short __ATTRS_o_ai
  6234. vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
  6235. return vec_perm(__a, __b, __c);
  6236. }
  6237. static __inline__ vector unsigned short __ATTRS_o_ai
  6238. vec_vperm(vector unsigned short __a, vector unsigned short __b,
  6239. vector unsigned char __c) {
  6240. return vec_perm(__a, __b, __c);
  6241. }
  6242. static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
  6243. vector bool short __a, vector bool short __b, vector unsigned char __c) {
  6244. return vec_perm(__a, __b, __c);
  6245. }
  6246. static __inline__ vector pixel __ATTRS_o_ai
  6247. vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
  6248. return vec_perm(__a, __b, __c);
  6249. }
  6250. static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
  6251. vector int __b,
  6252. vector unsigned char __c) {
  6253. return vec_perm(__a, __b, __c);
  6254. }
  6255. static __inline__ vector unsigned int __ATTRS_o_ai
  6256. vec_vperm(vector unsigned int __a, vector unsigned int __b,
  6257. vector unsigned char __c) {
  6258. return vec_perm(__a, __b, __c);
  6259. }
  6260. static __inline__ vector bool int __ATTRS_o_ai
  6261. vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
  6262. return vec_perm(__a, __b, __c);
  6263. }
  6264. static __inline__ vector float __ATTRS_o_ai
  6265. vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
  6266. return vec_perm(__a, __b, __c);
  6267. }
  6268. #ifdef __VSX__
  6269. static __inline__ vector long long __ATTRS_o_ai vec_vperm(
  6270. vector long long __a, vector long long __b, vector unsigned char __c) {
  6271. return vec_perm(__a, __b, __c);
  6272. }
  6273. static __inline__ vector unsigned long long __ATTRS_o_ai
  6274. vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
  6275. vector unsigned char __c) {
  6276. return vec_perm(__a, __b, __c);
  6277. }
  6278. static __inline__ vector double __ATTRS_o_ai
  6279. vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
  6280. return vec_perm(__a, __b, __c);
  6281. }
  6282. #endif
  6283. /* vec_re */
  6284. static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
  6285. #ifdef __VSX__
  6286. return __builtin_vsx_xvresp(__a);
  6287. #else
  6288. return __builtin_altivec_vrefp(__a);
  6289. #endif
  6290. }
  6291. #ifdef __VSX__
  6292. static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
  6293. return __builtin_vsx_xvredp(__a);
  6294. }
  6295. #endif
  6296. /* vec_vrefp */
  6297. static __inline__ vector float __attribute__((__always_inline__))
  6298. vec_vrefp(vector float __a) {
  6299. return __builtin_altivec_vrefp(__a);
  6300. }
  6301. /* vec_rl */
  6302. static __inline__ vector signed char __ATTRS_o_ai
  6303. vec_rl(vector signed char __a, vector unsigned char __b) {
  6304. return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
  6305. }
  6306. static __inline__ vector unsigned char __ATTRS_o_ai
  6307. vec_rl(vector unsigned char __a, vector unsigned char __b) {
  6308. return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
  6309. }
  6310. static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
  6311. vector unsigned short __b) {
  6312. return __builtin_altivec_vrlh(__a, __b);
  6313. }
  6314. static __inline__ vector unsigned short __ATTRS_o_ai
  6315. vec_rl(vector unsigned short __a, vector unsigned short __b) {
  6316. return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
  6317. }
  6318. static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
  6319. vector unsigned int __b) {
  6320. return __builtin_altivec_vrlw(__a, __b);
  6321. }
  6322. static __inline__ vector unsigned int __ATTRS_o_ai
  6323. vec_rl(vector unsigned int __a, vector unsigned int __b) {
  6324. return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
  6325. }
  6326. #ifdef __POWER8_VECTOR__
  6327. static __inline__ vector signed long long __ATTRS_o_ai
  6328. vec_rl(vector signed long long __a, vector unsigned long long __b) {
  6329. return __builtin_altivec_vrld(__a, __b);
  6330. }
  6331. static __inline__ vector unsigned long long __ATTRS_o_ai
  6332. vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
  6333. return __builtin_altivec_vrld(__a, __b);
  6334. }
  6335. #endif
  6336. /* vec_rlmi */
  6337. #ifdef __POWER9_VECTOR__
  6338. static __inline__ vector unsigned int __ATTRS_o_ai
  6339. vec_rlmi(vector unsigned int __a, vector unsigned int __b,
  6340. vector unsigned int __c) {
  6341. return __builtin_altivec_vrlwmi(__a, __c, __b);
  6342. }
  6343. static __inline__ vector unsigned long long __ATTRS_o_ai
  6344. vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
  6345. vector unsigned long long __c) {
  6346. return __builtin_altivec_vrldmi(__a, __c, __b);
  6347. }
  6348. /* vec_rlnm */
  6349. static __inline__ vector unsigned int __ATTRS_o_ai
  6350. vec_rlnm(vector unsigned int __a, vector unsigned int __b,
  6351. vector unsigned int __c) {
  6352. vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
  6353. return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
  6354. }
  6355. static __inline__ vector unsigned long long __ATTRS_o_ai
  6356. vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
  6357. vector unsigned long long __c) {
  6358. vector unsigned long long OneByte = { 0x8, 0x8 };
  6359. return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
  6360. }
  6361. #endif
  6362. /* vec_vrlb */
  6363. static __inline__ vector signed char __ATTRS_o_ai
  6364. vec_vrlb(vector signed char __a, vector unsigned char __b) {
  6365. return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
  6366. }
  6367. static __inline__ vector unsigned char __ATTRS_o_ai
  6368. vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
  6369. return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
  6370. }
  6371. /* vec_vrlh */
  6372. static __inline__ vector short __ATTRS_o_ai
  6373. vec_vrlh(vector short __a, vector unsigned short __b) {
  6374. return __builtin_altivec_vrlh(__a, __b);
  6375. }
  6376. static __inline__ vector unsigned short __ATTRS_o_ai
  6377. vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
  6378. return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
  6379. }
  6380. /* vec_vrlw */
  6381. static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
  6382. vector unsigned int __b) {
  6383. return __builtin_altivec_vrlw(__a, __b);
  6384. }
  6385. static __inline__ vector unsigned int __ATTRS_o_ai
  6386. vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
  6387. return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
  6388. }
  6389. /* vec_round */
  6390. static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
  6391. #ifdef __VSX__
  6392. return __builtin_vsx_xvrspi(__a);
  6393. #else
  6394. return __builtin_altivec_vrfin(__a);
  6395. #endif
  6396. }
  6397. #ifdef __VSX__
  6398. static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
  6399. return __builtin_vsx_xvrdpi(__a);
  6400. }
  6401. /* vec_rint */
  6402. static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
  6403. return __builtin_vsx_xvrspic(__a);
  6404. }
  6405. static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
  6406. return __builtin_vsx_xvrdpic(__a);
  6407. }
  6408. /* vec_nearbyint */
  6409. static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
  6410. return __builtin_vsx_xvrspi(__a);
  6411. }
  6412. static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
  6413. return __builtin_vsx_xvrdpi(__a);
  6414. }
  6415. #endif
  6416. /* vec_vrfin */
  6417. static __inline__ vector float __attribute__((__always_inline__))
  6418. vec_vrfin(vector float __a) {
  6419. return __builtin_altivec_vrfin(__a);
  6420. }
  6421. /* vec_sqrt */
  6422. #ifdef __VSX__
  6423. static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
  6424. return __builtin_vsx_xvsqrtsp(__a);
  6425. }
  6426. static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
  6427. return __builtin_vsx_xvsqrtdp(__a);
  6428. }
  6429. #endif
  6430. /* vec_rsqrte */
  6431. static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
  6432. #ifdef __VSX__
  6433. return __builtin_vsx_xvrsqrtesp(__a);
  6434. #else
  6435. return __builtin_altivec_vrsqrtefp(__a);
  6436. #endif
  6437. }
  6438. #ifdef __VSX__
  6439. static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
  6440. return __builtin_vsx_xvrsqrtedp(__a);
  6441. }
  6442. #endif
  6443. /* vec_vrsqrtefp */
  6444. static __inline__ __vector float __attribute__((__always_inline__))
  6445. vec_vrsqrtefp(vector float __a) {
  6446. return __builtin_altivec_vrsqrtefp(__a);
  6447. }
  6448. /* vec_sel */
  6449. #define __builtin_altivec_vsel_4si vec_sel
  6450. static __inline__ vector signed char __ATTRS_o_ai vec_sel(
  6451. vector signed char __a, vector signed char __b, vector unsigned char __c) {
  6452. return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
  6453. }
  6454. static __inline__ vector signed char __ATTRS_o_ai
  6455. vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
  6456. return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
  6457. }
  6458. static __inline__ vector unsigned char __ATTRS_o_ai
  6459. vec_sel(vector unsigned char __a, vector unsigned char __b,
  6460. vector unsigned char __c) {
  6461. return (__a & ~__c) | (__b & __c);
  6462. }
  6463. static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
  6464. vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
  6465. return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
  6466. }
  6467. static __inline__ vector bool char __ATTRS_o_ai
  6468. vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
  6469. return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
  6470. }
  6471. static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
  6472. vector bool char __b,
  6473. vector bool char __c) {
  6474. return (__a & ~__c) | (__b & __c);
  6475. }
  6476. static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
  6477. vector short __b,
  6478. vector unsigned short __c) {
  6479. return (__a & ~(vector short)__c) | (__b & (vector short)__c);
  6480. }
  6481. static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
  6482. vector short __b,
  6483. vector bool short __c) {
  6484. return (__a & ~(vector short)__c) | (__b & (vector short)__c);
  6485. }
  6486. static __inline__ vector unsigned short __ATTRS_o_ai
  6487. vec_sel(vector unsigned short __a, vector unsigned short __b,
  6488. vector unsigned short __c) {
  6489. return (__a & ~__c) | (__b & __c);
  6490. }
  6491. static __inline__ vector unsigned short __ATTRS_o_ai
  6492. vec_sel(vector unsigned short __a, vector unsigned short __b,
  6493. vector bool short __c) {
  6494. return (__a & ~(vector unsigned short)__c) |
  6495. (__b & (vector unsigned short)__c);
  6496. }
  6497. static __inline__ vector bool short __ATTRS_o_ai vec_sel(
  6498. vector bool short __a, vector bool short __b, vector unsigned short __c) {
  6499. return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
  6500. }
  6501. static __inline__ vector bool short __ATTRS_o_ai
  6502. vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
  6503. return (__a & ~__c) | (__b & __c);
  6504. }
  6505. static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
  6506. vector int __b,
  6507. vector unsigned int __c) {
  6508. return (__a & ~(vector int)__c) | (__b & (vector int)__c);
  6509. }
  6510. static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
  6511. vector int __b,
  6512. vector bool int __c) {
  6513. return (__a & ~(vector int)__c) | (__b & (vector int)__c);
  6514. }
  6515. static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
  6516. vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
  6517. return (__a & ~__c) | (__b & __c);
  6518. }
  6519. static __inline__ vector unsigned int __ATTRS_o_ai
  6520. vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
  6521. return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
  6522. }
  6523. static __inline__ vector bool int __ATTRS_o_ai
  6524. vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
  6525. return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
  6526. }
  6527. static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
  6528. vector bool int __b,
  6529. vector bool int __c) {
  6530. return (__a & ~__c) | (__b & __c);
  6531. }
  6532. static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
  6533. vector float __b,
  6534. vector unsigned int __c) {
  6535. vector int __res = ((vector int)__a & ~(vector int)__c) |
  6536. ((vector int)__b & (vector int)__c);
  6537. return (vector float)__res;
  6538. }
  6539. static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
  6540. vector float __b,
  6541. vector bool int __c) {
  6542. vector int __res = ((vector int)__a & ~(vector int)__c) |
  6543. ((vector int)__b & (vector int)__c);
  6544. return (vector float)__res;
  6545. }
  6546. #ifdef __VSX__
  6547. static __inline__ vector double __ATTRS_o_ai
  6548. vec_sel(vector double __a, vector double __b, vector bool long long __c) {
  6549. vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
  6550. ((vector long long)__b & (vector long long)__c);
  6551. return (vector double)__res;
  6552. }
  6553. static __inline__ vector double __ATTRS_o_ai
  6554. vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
  6555. vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
  6556. ((vector long long)__b & (vector long long)__c);
  6557. return (vector double)__res;
  6558. }
  6559. #endif
  6560. /* vec_vsel */
  6561. static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
  6562. vector signed char __a, vector signed char __b, vector unsigned char __c) {
  6563. return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
  6564. }
  6565. static __inline__ vector signed char __ATTRS_o_ai
  6566. vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
  6567. return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
  6568. }
  6569. static __inline__ vector unsigned char __ATTRS_o_ai
  6570. vec_vsel(vector unsigned char __a, vector unsigned char __b,
  6571. vector unsigned char __c) {
  6572. return (__a & ~__c) | (__b & __c);
  6573. }
  6574. static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
  6575. vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
  6576. return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
  6577. }
  6578. static __inline__ vector bool char __ATTRS_o_ai
  6579. vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
  6580. return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
  6581. }
  6582. static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
  6583. vector bool char __b,
  6584. vector bool char __c) {
  6585. return (__a & ~__c) | (__b & __c);
  6586. }
  6587. static __inline__ vector short __ATTRS_o_ai
  6588. vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
  6589. return (__a & ~(vector short)__c) | (__b & (vector short)__c);
  6590. }
  6591. static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
  6592. vector short __b,
  6593. vector bool short __c) {
  6594. return (__a & ~(vector short)__c) | (__b & (vector short)__c);
  6595. }
  6596. static __inline__ vector unsigned short __ATTRS_o_ai
  6597. vec_vsel(vector unsigned short __a, vector unsigned short __b,
  6598. vector unsigned short __c) {
  6599. return (__a & ~__c) | (__b & __c);
  6600. }
  6601. static __inline__ vector unsigned short __ATTRS_o_ai
  6602. vec_vsel(vector unsigned short __a, vector unsigned short __b,
  6603. vector bool short __c) {
  6604. return (__a & ~(vector unsigned short)__c) |
  6605. (__b & (vector unsigned short)__c);
  6606. }
  6607. static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
  6608. vector bool short __a, vector bool short __b, vector unsigned short __c) {
  6609. return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
  6610. }
  6611. static __inline__ vector bool short __ATTRS_o_ai
  6612. vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
  6613. return (__a & ~__c) | (__b & __c);
  6614. }
  6615. static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
  6616. vector int __b,
  6617. vector unsigned int __c) {
  6618. return (__a & ~(vector int)__c) | (__b & (vector int)__c);
  6619. }
  6620. static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
  6621. vector int __b,
  6622. vector bool int __c) {
  6623. return (__a & ~(vector int)__c) | (__b & (vector int)__c);
  6624. }
  6625. static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
  6626. vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
  6627. return (__a & ~__c) | (__b & __c);
  6628. }
  6629. static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
  6630. vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
  6631. return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
  6632. }
  6633. static __inline__ vector bool int __ATTRS_o_ai
  6634. vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
  6635. return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
  6636. }
  6637. static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
  6638. vector bool int __b,
  6639. vector bool int __c) {
  6640. return (__a & ~__c) | (__b & __c);
  6641. }
  6642. static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
  6643. vector float __b,
  6644. vector unsigned int __c) {
  6645. vector int __res = ((vector int)__a & ~(vector int)__c) |
  6646. ((vector int)__b & (vector int)__c);
  6647. return (vector float)__res;
  6648. }
  6649. static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
  6650. vector float __b,
  6651. vector bool int __c) {
  6652. vector int __res = ((vector int)__a & ~(vector int)__c) |
  6653. ((vector int)__b & (vector int)__c);
  6654. return (vector float)__res;
  6655. }
  6656. /* vec_sl */
  6657. // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
  6658. // than the length of __a.
  6659. static __inline__ vector unsigned char __ATTRS_o_ai
  6660. vec_sl(vector unsigned char __a, vector unsigned char __b) {
  6661. return __a << (__b %
  6662. (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
  6663. }
  6664. static __inline__ vector signed char __ATTRS_o_ai
  6665. vec_sl(vector signed char __a, vector unsigned char __b) {
  6666. return (vector signed char)vec_sl((vector unsigned char)__a, __b);
  6667. }
  6668. static __inline__ vector unsigned short __ATTRS_o_ai
  6669. vec_sl(vector unsigned short __a, vector unsigned short __b) {
  6670. return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
  6671. __CHAR_BIT__));
  6672. }
  6673. static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
  6674. vector unsigned short __b) {
  6675. return (vector short)vec_sl((vector unsigned short)__a, __b);
  6676. }
  6677. static __inline__ vector unsigned int __ATTRS_o_ai
  6678. vec_sl(vector unsigned int __a, vector unsigned int __b) {
  6679. return __a << (__b %
  6680. (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
  6681. }
  6682. static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
  6683. vector unsigned int __b) {
  6684. return (vector int)vec_sl((vector unsigned int)__a, __b);
  6685. }
  6686. #ifdef __POWER8_VECTOR__
  6687. static __inline__ vector unsigned long long __ATTRS_o_ai
  6688. vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
  6689. return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
  6690. __CHAR_BIT__));
  6691. }
  6692. static __inline__ vector long long __ATTRS_o_ai
  6693. vec_sl(vector long long __a, vector unsigned long long __b) {
  6694. return (vector long long)vec_sl((vector unsigned long long)__a, __b);
  6695. }
  6696. #endif
  6697. /* vec_vslb */
  6698. #define __builtin_altivec_vslb vec_vslb
  6699. static __inline__ vector signed char __ATTRS_o_ai
  6700. vec_vslb(vector signed char __a, vector unsigned char __b) {
  6701. return vec_sl(__a, __b);
  6702. }
  6703. static __inline__ vector unsigned char __ATTRS_o_ai
  6704. vec_vslb(vector unsigned char __a, vector unsigned char __b) {
  6705. return vec_sl(__a, __b);
  6706. }
  6707. /* vec_vslh */
  6708. #define __builtin_altivec_vslh vec_vslh
  6709. static __inline__ vector short __ATTRS_o_ai
  6710. vec_vslh(vector short __a, vector unsigned short __b) {
  6711. return vec_sl(__a, __b);
  6712. }
  6713. static __inline__ vector unsigned short __ATTRS_o_ai
  6714. vec_vslh(vector unsigned short __a, vector unsigned short __b) {
  6715. return vec_sl(__a, __b);
  6716. }
  6717. /* vec_vslw */
  6718. #define __builtin_altivec_vslw vec_vslw
  6719. static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
  6720. vector unsigned int __b) {
  6721. return vec_sl(__a, __b);
  6722. }
  6723. static __inline__ vector unsigned int __ATTRS_o_ai
  6724. vec_vslw(vector unsigned int __a, vector unsigned int __b) {
  6725. return vec_sl(__a, __b);
  6726. }
  6727. /* vec_sld */
  6728. #define __builtin_altivec_vsldoi_4si vec_sld
  6729. static __inline__ vector signed char __ATTRS_o_ai vec_sld(
  6730. vector signed char __a, vector signed char __b, unsigned const int __c) {
  6731. unsigned char __d = __c & 0x0F;
  6732. #ifdef __LITTLE_ENDIAN__
  6733. return vec_perm(
  6734. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6735. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6736. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6737. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6738. #else
  6739. return vec_perm(
  6740. __a, __b,
  6741. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6742. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6743. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6744. #endif
  6745. }
  6746. static __inline__ vector unsigned char __ATTRS_o_ai
  6747. vec_sld(vector unsigned char __a, vector unsigned char __b,
  6748. unsigned const int __c) {
  6749. unsigned char __d = __c & 0x0F;
  6750. #ifdef __LITTLE_ENDIAN__
  6751. return vec_perm(
  6752. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6753. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6754. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6755. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6756. #else
  6757. return vec_perm(
  6758. __a, __b,
  6759. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6760. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6761. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6762. #endif
  6763. }
  6764. static __inline__ vector bool char __ATTRS_o_ai
  6765. vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
  6766. unsigned char __d = __c & 0x0F;
  6767. #ifdef __LITTLE_ENDIAN__
  6768. return vec_perm(
  6769. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6770. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6771. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6772. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6773. #else
  6774. return vec_perm(
  6775. __a, __b,
  6776. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6777. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6778. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6779. #endif
  6780. }
  6781. static __inline__ vector signed short __ATTRS_o_ai vec_sld(
  6782. vector signed short __a, vector signed short __b, unsigned const int __c) {
  6783. unsigned char __d = __c & 0x0F;
  6784. #ifdef __LITTLE_ENDIAN__
  6785. return vec_perm(
  6786. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6787. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6788. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6789. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6790. #else
  6791. return vec_perm(
  6792. __a, __b,
  6793. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6794. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6795. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6796. #endif
  6797. }
  6798. static __inline__ vector unsigned short __ATTRS_o_ai
  6799. vec_sld(vector unsigned short __a, vector unsigned short __b,
  6800. unsigned const int __c) {
  6801. unsigned char __d = __c & 0x0F;
  6802. #ifdef __LITTLE_ENDIAN__
  6803. return vec_perm(
  6804. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6805. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6806. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6807. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6808. #else
  6809. return vec_perm(
  6810. __a, __b,
  6811. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6812. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6813. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6814. #endif
  6815. }
  6816. static __inline__ vector bool short __ATTRS_o_ai
  6817. vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
  6818. unsigned char __d = __c & 0x0F;
  6819. #ifdef __LITTLE_ENDIAN__
  6820. return vec_perm(
  6821. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6822. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6823. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6824. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6825. #else
  6826. return vec_perm(
  6827. __a, __b,
  6828. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6829. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6830. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6831. #endif
  6832. }
  6833. static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
  6834. vector pixel __b,
  6835. unsigned const int __c) {
  6836. unsigned char __d = __c & 0x0F;
  6837. #ifdef __LITTLE_ENDIAN__
  6838. return vec_perm(
  6839. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6840. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6841. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6842. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6843. #else
  6844. return vec_perm(
  6845. __a, __b,
  6846. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6847. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6848. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6849. #endif
  6850. }
  6851. static __inline__ vector signed int __ATTRS_o_ai
  6852. vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
  6853. unsigned char __d = __c & 0x0F;
  6854. #ifdef __LITTLE_ENDIAN__
  6855. return vec_perm(
  6856. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6857. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6858. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6859. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6860. #else
  6861. return vec_perm(
  6862. __a, __b,
  6863. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6864. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6865. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6866. #endif
  6867. }
  6868. static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
  6869. vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
  6870. unsigned char __d = __c & 0x0F;
  6871. #ifdef __LITTLE_ENDIAN__
  6872. return vec_perm(
  6873. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6874. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6875. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6876. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6877. #else
  6878. return vec_perm(
  6879. __a, __b,
  6880. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6881. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6882. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6883. #endif
  6884. }
  6885. static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
  6886. vector bool int __b,
  6887. unsigned const int __c) {
  6888. unsigned char __d = __c & 0x0F;
  6889. #ifdef __LITTLE_ENDIAN__
  6890. return vec_perm(
  6891. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6892. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6893. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6894. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6895. #else
  6896. return vec_perm(
  6897. __a, __b,
  6898. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6899. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6900. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6901. #endif
  6902. }
  6903. static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
  6904. vector float __b,
  6905. unsigned const int __c) {
  6906. unsigned char __d = __c & 0x0F;
  6907. #ifdef __LITTLE_ENDIAN__
  6908. return vec_perm(
  6909. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6910. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6911. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6912. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6913. #else
  6914. return vec_perm(
  6915. __a, __b,
  6916. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6917. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6918. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6919. #endif
  6920. }
  6921. #ifdef __VSX__
  6922. static __inline__ vector bool long long __ATTRS_o_ai
  6923. vec_sld(vector bool long long __a, vector bool long long __b,
  6924. unsigned const int __c) {
  6925. unsigned char __d = __c & 0x0F;
  6926. #ifdef __LITTLE_ENDIAN__
  6927. return vec_perm(
  6928. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6929. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6930. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6931. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6932. #else
  6933. return vec_perm(
  6934. __a, __b,
  6935. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6936. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6937. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6938. #endif
  6939. }
  6940. static __inline__ vector signed long long __ATTRS_o_ai
  6941. vec_sld(vector signed long long __a, vector signed long long __b,
  6942. unsigned const int __c) {
  6943. unsigned char __d = __c & 0x0F;
  6944. #ifdef __LITTLE_ENDIAN__
  6945. return vec_perm(
  6946. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6947. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6948. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6949. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6950. #else
  6951. return vec_perm(
  6952. __a, __b,
  6953. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6954. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6955. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6956. #endif
  6957. }
  6958. static __inline__ vector unsigned long long __ATTRS_o_ai
  6959. vec_sld(vector unsigned long long __a, vector unsigned long long __b,
  6960. unsigned const int __c) {
  6961. unsigned char __d = __c & 0x0F;
  6962. #ifdef __LITTLE_ENDIAN__
  6963. return vec_perm(
  6964. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6965. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6966. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6967. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6968. #else
  6969. return vec_perm(
  6970. __a, __b,
  6971. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6972. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6973. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6974. #endif
  6975. }
  6976. static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
  6977. vector double __b,
  6978. unsigned const int __c) {
  6979. unsigned char __d = __c & 0x0F;
  6980. #ifdef __LITTLE_ENDIAN__
  6981. return vec_perm(
  6982. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  6983. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  6984. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  6985. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  6986. #else
  6987. return vec_perm(
  6988. __a, __b,
  6989. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  6990. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  6991. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  6992. #endif
  6993. }
  6994. #endif
  6995. /* vec_sldw */
  6996. static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
  6997. vector signed char __a, vector signed char __b, unsigned const int __c) {
  6998. return vec_sld(__a, __b, ((__c << 2) & 0x0F));
  6999. }
  7000. static __inline__ vector unsigned char __ATTRS_o_ai
  7001. vec_sldw(vector unsigned char __a, vector unsigned char __b,
  7002. unsigned const int __c) {
  7003. return vec_sld(__a, __b, ((__c << 2) & 0x0F));
  7004. }
  7005. static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
  7006. vector signed short __a, vector signed short __b, unsigned const int __c) {
  7007. return vec_sld(__a, __b, ((__c << 2) & 0x0F));
  7008. }
  7009. static __inline__ vector unsigned short __ATTRS_o_ai
  7010. vec_sldw(vector unsigned short __a, vector unsigned short __b,
  7011. unsigned const int __c) {
  7012. return vec_sld(__a, __b, ((__c << 2) & 0x0F));
  7013. }
  7014. static __inline__ vector signed int __ATTRS_o_ai
  7015. vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
  7016. return vec_sld(__a, __b, ((__c << 2) & 0x0F));
  7017. }
  7018. static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
  7019. vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
  7020. return vec_sld(__a, __b, ((__c << 2) & 0x0F));
  7021. }
  7022. #ifdef __VSX__
  7023. static __inline__ vector signed long long __ATTRS_o_ai
  7024. vec_sldw(vector signed long long __a, vector signed long long __b,
  7025. unsigned const int __c) {
  7026. return vec_sld(__a, __b, ((__c << 2) & 0x0F));
  7027. }
  7028. static __inline__ vector unsigned long long __ATTRS_o_ai
  7029. vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
  7030. unsigned const int __c) {
  7031. return vec_sld(__a, __b, ((__c << 2) & 0x0F));
  7032. }
  7033. #endif
  7034. #ifdef __POWER9_VECTOR__
  7035. /* vec_slv */
  7036. static __inline__ vector unsigned char __ATTRS_o_ai
  7037. vec_slv(vector unsigned char __a, vector unsigned char __b) {
  7038. return __builtin_altivec_vslv(__a, __b);
  7039. }
  7040. /* vec_srv */
  7041. static __inline__ vector unsigned char __ATTRS_o_ai
  7042. vec_srv(vector unsigned char __a, vector unsigned char __b) {
  7043. return __builtin_altivec_vsrv(__a, __b);
  7044. }
  7045. #endif
  7046. /* vec_vsldoi */
  7047. static __inline__ vector signed char __ATTRS_o_ai
  7048. vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
  7049. unsigned char __d = __c & 0x0F;
  7050. #ifdef __LITTLE_ENDIAN__
  7051. return vec_perm(
  7052. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  7053. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  7054. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  7055. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  7056. #else
  7057. return vec_perm(
  7058. __a, __b,
  7059. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  7060. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  7061. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  7062. #endif
  7063. }
  7064. static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
  7065. vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
  7066. unsigned char __d = __c & 0x0F;
  7067. #ifdef __LITTLE_ENDIAN__
  7068. return vec_perm(
  7069. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  7070. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  7071. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  7072. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  7073. #else
  7074. return vec_perm(
  7075. __a, __b,
  7076. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  7077. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  7078. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  7079. #endif
  7080. }
  7081. static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
  7082. vector short __b,
  7083. unsigned char __c) {
  7084. unsigned char __d = __c & 0x0F;
  7085. #ifdef __LITTLE_ENDIAN__
  7086. return vec_perm(
  7087. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  7088. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  7089. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  7090. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  7091. #else
  7092. return vec_perm(
  7093. __a, __b,
  7094. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  7095. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  7096. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  7097. #endif
  7098. }
  7099. static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
  7100. vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
  7101. unsigned char __d = __c & 0x0F;
  7102. #ifdef __LITTLE_ENDIAN__
  7103. return vec_perm(
  7104. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  7105. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  7106. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  7107. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  7108. #else
  7109. return vec_perm(
  7110. __a, __b,
  7111. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  7112. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  7113. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  7114. #endif
  7115. }
  7116. static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
  7117. vector pixel __b,
  7118. unsigned char __c) {
  7119. unsigned char __d = __c & 0x0F;
  7120. #ifdef __LITTLE_ENDIAN__
  7121. return vec_perm(
  7122. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  7123. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  7124. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  7125. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  7126. #else
  7127. return vec_perm(
  7128. __a, __b,
  7129. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  7130. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  7131. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  7132. #endif
  7133. }
  7134. static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
  7135. vector int __b,
  7136. unsigned char __c) {
  7137. unsigned char __d = __c & 0x0F;
  7138. #ifdef __LITTLE_ENDIAN__
  7139. return vec_perm(
  7140. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  7141. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  7142. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  7143. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  7144. #else
  7145. return vec_perm(
  7146. __a, __b,
  7147. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  7148. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  7149. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  7150. #endif
  7151. }
  7152. static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
  7153. vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
  7154. unsigned char __d = __c & 0x0F;
  7155. #ifdef __LITTLE_ENDIAN__
  7156. return vec_perm(
  7157. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  7158. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  7159. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  7160. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  7161. #else
  7162. return vec_perm(
  7163. __a, __b,
  7164. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  7165. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  7166. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  7167. #endif
  7168. }
  7169. static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
  7170. vector float __b,
  7171. unsigned char __c) {
  7172. unsigned char __d = __c & 0x0F;
  7173. #ifdef __LITTLE_ENDIAN__
  7174. return vec_perm(
  7175. __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
  7176. 20 - __d, 21 - __d, 22 - __d, 23 - __d,
  7177. 24 - __d, 25 - __d, 26 - __d, 27 - __d,
  7178. 28 - __d, 29 - __d, 30 - __d, 31 - __d));
  7179. #else
  7180. return vec_perm(
  7181. __a, __b,
  7182. (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
  7183. __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
  7184. __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
  7185. #endif
  7186. }
  7187. /* vec_sll */
  7188. static __inline__ vector signed char __ATTRS_o_ai
  7189. vec_sll(vector signed char __a, vector unsigned char __b) {
  7190. return (vector signed char)__builtin_altivec_vsl((vector int)__a,
  7191. (vector int)__b);
  7192. }
  7193. static __inline__ vector signed char __ATTRS_o_ai
  7194. vec_sll(vector signed char __a, vector unsigned short __b) {
  7195. return (vector signed char)__builtin_altivec_vsl((vector int)__a,
  7196. (vector int)__b);
  7197. }
  7198. static __inline__ vector signed char __ATTRS_o_ai
  7199. vec_sll(vector signed char __a, vector unsigned int __b) {
  7200. return (vector signed char)__builtin_altivec_vsl((vector int)__a,
  7201. (vector int)__b);
  7202. }
  7203. static __inline__ vector unsigned char __ATTRS_o_ai
  7204. vec_sll(vector unsigned char __a, vector unsigned char __b) {
  7205. return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
  7206. (vector int)__b);
  7207. }
  7208. static __inline__ vector unsigned char __ATTRS_o_ai
  7209. vec_sll(vector unsigned char __a, vector unsigned short __b) {
  7210. return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
  7211. (vector int)__b);
  7212. }
  7213. static __inline__ vector unsigned char __ATTRS_o_ai
  7214. vec_sll(vector unsigned char __a, vector unsigned int __b) {
  7215. return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
  7216. (vector int)__b);
  7217. }
  7218. static __inline__ vector bool char __ATTRS_o_ai
  7219. vec_sll(vector bool char __a, vector unsigned char __b) {
  7220. return (vector bool char)__builtin_altivec_vsl((vector int)__a,
  7221. (vector int)__b);
  7222. }
  7223. static __inline__ vector bool char __ATTRS_o_ai
  7224. vec_sll(vector bool char __a, vector unsigned short __b) {
  7225. return (vector bool char)__builtin_altivec_vsl((vector int)__a,
  7226. (vector int)__b);
  7227. }
  7228. static __inline__ vector bool char __ATTRS_o_ai
  7229. vec_sll(vector bool char __a, vector unsigned int __b) {
  7230. return (vector bool char)__builtin_altivec_vsl((vector int)__a,
  7231. (vector int)__b);
  7232. }
  7233. static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
  7234. vector unsigned char __b) {
  7235. return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7236. }
  7237. static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
  7238. vector unsigned short __b) {
  7239. return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7240. }
  7241. static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
  7242. vector unsigned int __b) {
  7243. return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7244. }
  7245. static __inline__ vector unsigned short __ATTRS_o_ai
  7246. vec_sll(vector unsigned short __a, vector unsigned char __b) {
  7247. return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
  7248. (vector int)__b);
  7249. }
  7250. static __inline__ vector unsigned short __ATTRS_o_ai
  7251. vec_sll(vector unsigned short __a, vector unsigned short __b) {
  7252. return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
  7253. (vector int)__b);
  7254. }
  7255. static __inline__ vector unsigned short __ATTRS_o_ai
  7256. vec_sll(vector unsigned short __a, vector unsigned int __b) {
  7257. return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
  7258. (vector int)__b);
  7259. }
  7260. static __inline__ vector bool short __ATTRS_o_ai
  7261. vec_sll(vector bool short __a, vector unsigned char __b) {
  7262. return (vector bool short)__builtin_altivec_vsl((vector int)__a,
  7263. (vector int)__b);
  7264. }
  7265. static __inline__ vector bool short __ATTRS_o_ai
  7266. vec_sll(vector bool short __a, vector unsigned short __b) {
  7267. return (vector bool short)__builtin_altivec_vsl((vector int)__a,
  7268. (vector int)__b);
  7269. }
  7270. static __inline__ vector bool short __ATTRS_o_ai
  7271. vec_sll(vector bool short __a, vector unsigned int __b) {
  7272. return (vector bool short)__builtin_altivec_vsl((vector int)__a,
  7273. (vector int)__b);
  7274. }
  7275. static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
  7276. vector unsigned char __b) {
  7277. return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7278. }
  7279. static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
  7280. vector unsigned short __b) {
  7281. return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7282. }
  7283. static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
  7284. vector unsigned int __b) {
  7285. return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7286. }
  7287. static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
  7288. vector unsigned char __b) {
  7289. return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
  7290. }
  7291. static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
  7292. vector unsigned short __b) {
  7293. return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
  7294. }
  7295. static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
  7296. vector unsigned int __b) {
  7297. return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
  7298. }
  7299. static __inline__ vector unsigned int __ATTRS_o_ai
  7300. vec_sll(vector unsigned int __a, vector unsigned char __b) {
  7301. return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
  7302. (vector int)__b);
  7303. }
  7304. static __inline__ vector unsigned int __ATTRS_o_ai
  7305. vec_sll(vector unsigned int __a, vector unsigned short __b) {
  7306. return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
  7307. (vector int)__b);
  7308. }
  7309. static __inline__ vector unsigned int __ATTRS_o_ai
  7310. vec_sll(vector unsigned int __a, vector unsigned int __b) {
  7311. return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
  7312. (vector int)__b);
  7313. }
  7314. static __inline__ vector bool int __ATTRS_o_ai
  7315. vec_sll(vector bool int __a, vector unsigned char __b) {
  7316. return (vector bool int)__builtin_altivec_vsl((vector int)__a,
  7317. (vector int)__b);
  7318. }
  7319. static __inline__ vector bool int __ATTRS_o_ai
  7320. vec_sll(vector bool int __a, vector unsigned short __b) {
  7321. return (vector bool int)__builtin_altivec_vsl((vector int)__a,
  7322. (vector int)__b);
  7323. }
  7324. static __inline__ vector bool int __ATTRS_o_ai
  7325. vec_sll(vector bool int __a, vector unsigned int __b) {
  7326. return (vector bool int)__builtin_altivec_vsl((vector int)__a,
  7327. (vector int)__b);
  7328. }
  7329. #ifdef __VSX__
  7330. static __inline__ vector signed long long __ATTRS_o_ai
  7331. vec_sll(vector signed long long __a, vector unsigned char __b) {
  7332. return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
  7333. (vector int)__b);
  7334. }
  7335. static __inline__ vector unsigned long long __ATTRS_o_ai
  7336. vec_sll(vector unsigned long long __a, vector unsigned char __b) {
  7337. return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
  7338. (vector int)__b);
  7339. }
  7340. #endif
  7341. /* vec_vsl */
  7342. static __inline__ vector signed char __ATTRS_o_ai
  7343. vec_vsl(vector signed char __a, vector unsigned char __b) {
  7344. return (vector signed char)__builtin_altivec_vsl((vector int)__a,
  7345. (vector int)__b);
  7346. }
  7347. static __inline__ vector signed char __ATTRS_o_ai
  7348. vec_vsl(vector signed char __a, vector unsigned short __b) {
  7349. return (vector signed char)__builtin_altivec_vsl((vector int)__a,
  7350. (vector int)__b);
  7351. }
  7352. static __inline__ vector signed char __ATTRS_o_ai
  7353. vec_vsl(vector signed char __a, vector unsigned int __b) {
  7354. return (vector signed char)__builtin_altivec_vsl((vector int)__a,
  7355. (vector int)__b);
  7356. }
  7357. static __inline__ vector unsigned char __ATTRS_o_ai
  7358. vec_vsl(vector unsigned char __a, vector unsigned char __b) {
  7359. return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
  7360. (vector int)__b);
  7361. }
  7362. static __inline__ vector unsigned char __ATTRS_o_ai
  7363. vec_vsl(vector unsigned char __a, vector unsigned short __b) {
  7364. return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
  7365. (vector int)__b);
  7366. }
  7367. static __inline__ vector unsigned char __ATTRS_o_ai
  7368. vec_vsl(vector unsigned char __a, vector unsigned int __b) {
  7369. return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
  7370. (vector int)__b);
  7371. }
  7372. static __inline__ vector bool char __ATTRS_o_ai
  7373. vec_vsl(vector bool char __a, vector unsigned char __b) {
  7374. return (vector bool char)__builtin_altivec_vsl((vector int)__a,
  7375. (vector int)__b);
  7376. }
  7377. static __inline__ vector bool char __ATTRS_o_ai
  7378. vec_vsl(vector bool char __a, vector unsigned short __b) {
  7379. return (vector bool char)__builtin_altivec_vsl((vector int)__a,
  7380. (vector int)__b);
  7381. }
  7382. static __inline__ vector bool char __ATTRS_o_ai
  7383. vec_vsl(vector bool char __a, vector unsigned int __b) {
  7384. return (vector bool char)__builtin_altivec_vsl((vector int)__a,
  7385. (vector int)__b);
  7386. }
  7387. static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
  7388. vector unsigned char __b) {
  7389. return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7390. }
  7391. static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
  7392. vector unsigned short __b) {
  7393. return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7394. }
  7395. static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
  7396. vector unsigned int __b) {
  7397. return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7398. }
  7399. static __inline__ vector unsigned short __ATTRS_o_ai
  7400. vec_vsl(vector unsigned short __a, vector unsigned char __b) {
  7401. return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
  7402. (vector int)__b);
  7403. }
  7404. static __inline__ vector unsigned short __ATTRS_o_ai
  7405. vec_vsl(vector unsigned short __a, vector unsigned short __b) {
  7406. return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
  7407. (vector int)__b);
  7408. }
  7409. static __inline__ vector unsigned short __ATTRS_o_ai
  7410. vec_vsl(vector unsigned short __a, vector unsigned int __b) {
  7411. return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
  7412. (vector int)__b);
  7413. }
  7414. static __inline__ vector bool short __ATTRS_o_ai
  7415. vec_vsl(vector bool short __a, vector unsigned char __b) {
  7416. return (vector bool short)__builtin_altivec_vsl((vector int)__a,
  7417. (vector int)__b);
  7418. }
  7419. static __inline__ vector bool short __ATTRS_o_ai
  7420. vec_vsl(vector bool short __a, vector unsigned short __b) {
  7421. return (vector bool short)__builtin_altivec_vsl((vector int)__a,
  7422. (vector int)__b);
  7423. }
  7424. static __inline__ vector bool short __ATTRS_o_ai
  7425. vec_vsl(vector bool short __a, vector unsigned int __b) {
  7426. return (vector bool short)__builtin_altivec_vsl((vector int)__a,
  7427. (vector int)__b);
  7428. }
  7429. static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
  7430. vector unsigned char __b) {
  7431. return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7432. }
  7433. static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
  7434. vector unsigned short __b) {
  7435. return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7436. }
  7437. static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
  7438. vector unsigned int __b) {
  7439. return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
  7440. }
  7441. static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
  7442. vector unsigned char __b) {
  7443. return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
  7444. }
  7445. static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
  7446. vector unsigned short __b) {
  7447. return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
  7448. }
  7449. static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
  7450. vector unsigned int __b) {
  7451. return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
  7452. }
  7453. static __inline__ vector unsigned int __ATTRS_o_ai
  7454. vec_vsl(vector unsigned int __a, vector unsigned char __b) {
  7455. return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
  7456. (vector int)__b);
  7457. }
  7458. static __inline__ vector unsigned int __ATTRS_o_ai
  7459. vec_vsl(vector unsigned int __a, vector unsigned short __b) {
  7460. return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
  7461. (vector int)__b);
  7462. }
  7463. static __inline__ vector unsigned int __ATTRS_o_ai
  7464. vec_vsl(vector unsigned int __a, vector unsigned int __b) {
  7465. return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
  7466. (vector int)__b);
  7467. }
  7468. static __inline__ vector bool int __ATTRS_o_ai
  7469. vec_vsl(vector bool int __a, vector unsigned char __b) {
  7470. return (vector bool int)__builtin_altivec_vsl((vector int)__a,
  7471. (vector int)__b);
  7472. }
  7473. static __inline__ vector bool int __ATTRS_o_ai
  7474. vec_vsl(vector bool int __a, vector unsigned short __b) {
  7475. return (vector bool int)__builtin_altivec_vsl((vector int)__a,
  7476. (vector int)__b);
  7477. }
  7478. static __inline__ vector bool int __ATTRS_o_ai
  7479. vec_vsl(vector bool int __a, vector unsigned int __b) {
  7480. return (vector bool int)__builtin_altivec_vsl((vector int)__a,
  7481. (vector int)__b);
  7482. }
  7483. /* vec_slo */
  7484. static __inline__ vector signed char __ATTRS_o_ai
  7485. vec_slo(vector signed char __a, vector signed char __b) {
  7486. return (vector signed char)__builtin_altivec_vslo((vector int)__a,
  7487. (vector int)__b);
  7488. }
  7489. static __inline__ vector signed char __ATTRS_o_ai
  7490. vec_slo(vector signed char __a, vector unsigned char __b) {
  7491. return (vector signed char)__builtin_altivec_vslo((vector int)__a,
  7492. (vector int)__b);
  7493. }
  7494. static __inline__ vector unsigned char __ATTRS_o_ai
  7495. vec_slo(vector unsigned char __a, vector signed char __b) {
  7496. return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
  7497. (vector int)__b);
  7498. }
  7499. static __inline__ vector unsigned char __ATTRS_o_ai
  7500. vec_slo(vector unsigned char __a, vector unsigned char __b) {
  7501. return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
  7502. (vector int)__b);
  7503. }
  7504. static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
  7505. vector signed char __b) {
  7506. return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7507. }
  7508. static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
  7509. vector unsigned char __b) {
  7510. return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7511. }
  7512. static __inline__ vector unsigned short __ATTRS_o_ai
  7513. vec_slo(vector unsigned short __a, vector signed char __b) {
  7514. return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
  7515. (vector int)__b);
  7516. }
  7517. static __inline__ vector unsigned short __ATTRS_o_ai
  7518. vec_slo(vector unsigned short __a, vector unsigned char __b) {
  7519. return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
  7520. (vector int)__b);
  7521. }
  7522. static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
  7523. vector signed char __b) {
  7524. return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7525. }
  7526. static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
  7527. vector unsigned char __b) {
  7528. return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7529. }
  7530. static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
  7531. vector signed char __b) {
  7532. return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
  7533. }
  7534. static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
  7535. vector unsigned char __b) {
  7536. return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
  7537. }
  7538. static __inline__ vector unsigned int __ATTRS_o_ai
  7539. vec_slo(vector unsigned int __a, vector signed char __b) {
  7540. return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
  7541. (vector int)__b);
  7542. }
  7543. static __inline__ vector unsigned int __ATTRS_o_ai
  7544. vec_slo(vector unsigned int __a, vector unsigned char __b) {
  7545. return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
  7546. (vector int)__b);
  7547. }
  7548. static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
  7549. vector signed char __b) {
  7550. return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7551. }
  7552. static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
  7553. vector unsigned char __b) {
  7554. return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7555. }
  7556. #ifdef __VSX__
  7557. static __inline__ vector signed long long __ATTRS_o_ai
  7558. vec_slo(vector signed long long __a, vector signed char __b) {
  7559. return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
  7560. (vector int)__b);
  7561. }
  7562. static __inline__ vector signed long long __ATTRS_o_ai
  7563. vec_slo(vector signed long long __a, vector unsigned char __b) {
  7564. return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
  7565. (vector int)__b);
  7566. }
  7567. static __inline__ vector unsigned long long __ATTRS_o_ai
  7568. vec_slo(vector unsigned long long __a, vector signed char __b) {
  7569. return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
  7570. (vector int)__b);
  7571. }
  7572. static __inline__ vector unsigned long long __ATTRS_o_ai
  7573. vec_slo(vector unsigned long long __a, vector unsigned char __b) {
  7574. return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
  7575. (vector int)__b);
  7576. }
  7577. #endif
  7578. /* vec_vslo */
  7579. static __inline__ vector signed char __ATTRS_o_ai
  7580. vec_vslo(vector signed char __a, vector signed char __b) {
  7581. return (vector signed char)__builtin_altivec_vslo((vector int)__a,
  7582. (vector int)__b);
  7583. }
  7584. static __inline__ vector signed char __ATTRS_o_ai
  7585. vec_vslo(vector signed char __a, vector unsigned char __b) {
  7586. return (vector signed char)__builtin_altivec_vslo((vector int)__a,
  7587. (vector int)__b);
  7588. }
  7589. static __inline__ vector unsigned char __ATTRS_o_ai
  7590. vec_vslo(vector unsigned char __a, vector signed char __b) {
  7591. return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
  7592. (vector int)__b);
  7593. }
  7594. static __inline__ vector unsigned char __ATTRS_o_ai
  7595. vec_vslo(vector unsigned char __a, vector unsigned char __b) {
  7596. return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
  7597. (vector int)__b);
  7598. }
  7599. static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
  7600. vector signed char __b) {
  7601. return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7602. }
  7603. static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
  7604. vector unsigned char __b) {
  7605. return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7606. }
  7607. static __inline__ vector unsigned short __ATTRS_o_ai
  7608. vec_vslo(vector unsigned short __a, vector signed char __b) {
  7609. return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
  7610. (vector int)__b);
  7611. }
  7612. static __inline__ vector unsigned short __ATTRS_o_ai
  7613. vec_vslo(vector unsigned short __a, vector unsigned char __b) {
  7614. return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
  7615. (vector int)__b);
  7616. }
  7617. static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
  7618. vector signed char __b) {
  7619. return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7620. }
  7621. static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
  7622. vector unsigned char __b) {
  7623. return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7624. }
  7625. static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
  7626. vector signed char __b) {
  7627. return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
  7628. }
  7629. static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
  7630. vector unsigned char __b) {
  7631. return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
  7632. }
  7633. static __inline__ vector unsigned int __ATTRS_o_ai
  7634. vec_vslo(vector unsigned int __a, vector signed char __b) {
  7635. return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
  7636. (vector int)__b);
  7637. }
  7638. static __inline__ vector unsigned int __ATTRS_o_ai
  7639. vec_vslo(vector unsigned int __a, vector unsigned char __b) {
  7640. return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
  7641. (vector int)__b);
  7642. }
  7643. static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
  7644. vector signed char __b) {
  7645. return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7646. }
  7647. static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
  7648. vector unsigned char __b) {
  7649. return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
  7650. }
  7651. /* vec_splat */
  7652. static __inline__ vector signed char __ATTRS_o_ai
  7653. vec_splat(vector signed char __a, unsigned const int __b) {
  7654. return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
  7655. }
  7656. static __inline__ vector unsigned char __ATTRS_o_ai
  7657. vec_splat(vector unsigned char __a, unsigned const int __b) {
  7658. return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
  7659. }
  7660. static __inline__ vector bool char __ATTRS_o_ai
  7661. vec_splat(vector bool char __a, unsigned const int __b) {
  7662. return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
  7663. }
  7664. static __inline__ vector signed short __ATTRS_o_ai
  7665. vec_splat(vector signed short __a, unsigned const int __b) {
  7666. unsigned char b0 = (__b & 0x07) * 2;
  7667. unsigned char b1 = b0 + 1;
  7668. return vec_perm(__a, __a,
  7669. (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
  7670. b0, b1, b0, b1, b0, b1));
  7671. }
  7672. static __inline__ vector unsigned short __ATTRS_o_ai
  7673. vec_splat(vector unsigned short __a, unsigned const int __b) {
  7674. unsigned char b0 = (__b & 0x07) * 2;
  7675. unsigned char b1 = b0 + 1;
  7676. return vec_perm(__a, __a,
  7677. (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
  7678. b0, b1, b0, b1, b0, b1));
  7679. }
  7680. static __inline__ vector bool short __ATTRS_o_ai
  7681. vec_splat(vector bool short __a, unsigned const int __b) {
  7682. unsigned char b0 = (__b & 0x07) * 2;
  7683. unsigned char b1 = b0 + 1;
  7684. return vec_perm(__a, __a,
  7685. (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
  7686. b0, b1, b0, b1, b0, b1));
  7687. }
  7688. static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
  7689. unsigned const int __b) {
  7690. unsigned char b0 = (__b & 0x07) * 2;
  7691. unsigned char b1 = b0 + 1;
  7692. return vec_perm(__a, __a,
  7693. (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
  7694. b0, b1, b0, b1, b0, b1));
  7695. }
  7696. static __inline__ vector signed int __ATTRS_o_ai
  7697. vec_splat(vector signed int __a, unsigned const int __b) {
  7698. unsigned char b0 = (__b & 0x03) * 4;
  7699. unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
  7700. return vec_perm(__a, __a,
  7701. (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
  7702. b2, b3, b0, b1, b2, b3));
  7703. }
  7704. static __inline__ vector unsigned int __ATTRS_o_ai
  7705. vec_splat(vector unsigned int __a, unsigned const int __b) {
  7706. unsigned char b0 = (__b & 0x03) * 4;
  7707. unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
  7708. return vec_perm(__a, __a,
  7709. (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
  7710. b2, b3, b0, b1, b2, b3));
  7711. }
  7712. static __inline__ vector bool int __ATTRS_o_ai
  7713. vec_splat(vector bool int __a, unsigned const int __b) {
  7714. unsigned char b0 = (__b & 0x03) * 4;
  7715. unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
  7716. return vec_perm(__a, __a,
  7717. (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
  7718. b2, b3, b0, b1, b2, b3));
  7719. }
  7720. static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
  7721. unsigned const int __b) {
  7722. unsigned char b0 = (__b & 0x03) * 4;
  7723. unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
  7724. return vec_perm(__a, __a,
  7725. (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
  7726. b2, b3, b0, b1, b2, b3));
  7727. }
  7728. #ifdef __VSX__
  7729. static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
  7730. unsigned const int __b) {
  7731. unsigned char b0 = (__b & 0x01) * 8;
  7732. unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
  7733. b6 = b0 + 6, b7 = b0 + 7;
  7734. return vec_perm(__a, __a,
  7735. (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
  7736. b2, b3, b4, b5, b6, b7));
  7737. }
  7738. static __inline__ vector bool long long __ATTRS_o_ai
  7739. vec_splat(vector bool long long __a, unsigned const int __b) {
  7740. unsigned char b0 = (__b & 0x01) * 8;
  7741. unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
  7742. b6 = b0 + 6, b7 = b0 + 7;
  7743. return vec_perm(__a, __a,
  7744. (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
  7745. b2, b3, b4, b5, b6, b7));
  7746. }
  7747. static __inline__ vector signed long long __ATTRS_o_ai
  7748. vec_splat(vector signed long long __a, unsigned const int __b) {
  7749. unsigned char b0 = (__b & 0x01) * 8;
  7750. unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
  7751. b6 = b0 + 6, b7 = b0 + 7;
  7752. return vec_perm(__a, __a,
  7753. (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
  7754. b2, b3, b4, b5, b6, b7));
  7755. }
  7756. static __inline__ vector unsigned long long __ATTRS_o_ai
  7757. vec_splat(vector unsigned long long __a, unsigned const int __b) {
  7758. unsigned char b0 = (__b & 0x01) * 8;
  7759. unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
  7760. b6 = b0 + 6, b7 = b0 + 7;
  7761. return vec_perm(__a, __a,
  7762. (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
  7763. b2, b3, b4, b5, b6, b7));
  7764. }
  7765. #endif
  7766. /* vec_vspltb */
  7767. #define __builtin_altivec_vspltb vec_vspltb
  7768. static __inline__ vector signed char __ATTRS_o_ai
  7769. vec_vspltb(vector signed char __a, unsigned char __b) {
  7770. return vec_perm(__a, __a, (vector unsigned char)(__b));
  7771. }
  7772. static __inline__ vector unsigned char __ATTRS_o_ai
  7773. vec_vspltb(vector unsigned char __a, unsigned char __b) {
  7774. return vec_perm(__a, __a, (vector unsigned char)(__b));
  7775. }
  7776. static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
  7777. unsigned char __b) {
  7778. return vec_perm(__a, __a, (vector unsigned char)(__b));
  7779. }
  7780. /* vec_vsplth */
  7781. #define __builtin_altivec_vsplth vec_vsplth
  7782. static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
  7783. unsigned char __b) {
  7784. __b *= 2;
  7785. unsigned char b1 = __b + 1;
  7786. return vec_perm(__a, __a,
  7787. (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
  7788. __b, b1, __b, b1, __b, b1, __b, b1));
  7789. }
  7790. static __inline__ vector unsigned short __ATTRS_o_ai
  7791. vec_vsplth(vector unsigned short __a, unsigned char __b) {
  7792. __b *= 2;
  7793. unsigned char b1 = __b + 1;
  7794. return vec_perm(__a, __a,
  7795. (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
  7796. __b, b1, __b, b1, __b, b1, __b, b1));
  7797. }
  7798. static __inline__ vector bool short __ATTRS_o_ai
  7799. vec_vsplth(vector bool short __a, unsigned char __b) {
  7800. __b *= 2;
  7801. unsigned char b1 = __b + 1;
  7802. return vec_perm(__a, __a,
  7803. (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
  7804. __b, b1, __b, b1, __b, b1, __b, b1));
  7805. }
  7806. static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
  7807. unsigned char __b) {
  7808. __b *= 2;
  7809. unsigned char b1 = __b + 1;
  7810. return vec_perm(__a, __a,
  7811. (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
  7812. __b, b1, __b, b1, __b, b1, __b, b1));
  7813. }
  7814. /* vec_vspltw */
  7815. #define __builtin_altivec_vspltw vec_vspltw
  7816. static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
  7817. unsigned char __b) {
  7818. __b *= 4;
  7819. unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
  7820. return vec_perm(__a, __a,
  7821. (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
  7822. b1, b2, b3, __b, b1, b2, b3));
  7823. }
  7824. static __inline__ vector unsigned int __ATTRS_o_ai
  7825. vec_vspltw(vector unsigned int __a, unsigned char __b) {
  7826. __b *= 4;
  7827. unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
  7828. return vec_perm(__a, __a,
  7829. (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
  7830. b1, b2, b3, __b, b1, b2, b3));
  7831. }
  7832. static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
  7833. unsigned char __b) {
  7834. __b *= 4;
  7835. unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
  7836. return vec_perm(__a, __a,
  7837. (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
  7838. b1, b2, b3, __b, b1, b2, b3));
  7839. }
  7840. static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
  7841. unsigned char __b) {
  7842. __b *= 4;
  7843. unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
  7844. return vec_perm(__a, __a,
  7845. (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
  7846. b1, b2, b3, __b, b1, b2, b3));
  7847. }
  7848. /* vec_splat_s8 */
  7849. #define __builtin_altivec_vspltisb vec_splat_s8
  7850. // FIXME: parameter should be treated as 5-bit signed literal
  7851. static __inline__ vector signed char __ATTRS_o_ai
  7852. vec_splat_s8(signed char __a) {
  7853. return (vector signed char)(__a);
  7854. }
  7855. /* vec_vspltisb */
  7856. // FIXME: parameter should be treated as 5-bit signed literal
  7857. static __inline__ vector signed char __ATTRS_o_ai
  7858. vec_vspltisb(signed char __a) {
  7859. return (vector signed char)(__a);
  7860. }
  7861. /* vec_splat_s16 */
  7862. #define __builtin_altivec_vspltish vec_splat_s16
  7863. // FIXME: parameter should be treated as 5-bit signed literal
  7864. static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
  7865. return (vector short)(__a);
  7866. }
  7867. /* vec_vspltish */
  7868. // FIXME: parameter should be treated as 5-bit signed literal
  7869. static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
  7870. return (vector short)(__a);
  7871. }
  7872. /* vec_splat_s32 */
  7873. #define __builtin_altivec_vspltisw vec_splat_s32
  7874. // FIXME: parameter should be treated as 5-bit signed literal
  7875. static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
  7876. return (vector int)(__a);
  7877. }
  7878. /* vec_vspltisw */
  7879. // FIXME: parameter should be treated as 5-bit signed literal
  7880. static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
  7881. return (vector int)(__a);
  7882. }
  7883. /* vec_splat_u8 */
  7884. // FIXME: parameter should be treated as 5-bit signed literal
  7885. static __inline__ vector unsigned char __ATTRS_o_ai
  7886. vec_splat_u8(unsigned char __a) {
  7887. return (vector unsigned char)(__a);
  7888. }
  7889. /* vec_splat_u16 */
  7890. // FIXME: parameter should be treated as 5-bit signed literal
  7891. static __inline__ vector unsigned short __ATTRS_o_ai
  7892. vec_splat_u16(signed char __a) {
  7893. return (vector unsigned short)(__a);
  7894. }
  7895. /* vec_splat_u32 */
  7896. // FIXME: parameter should be treated as 5-bit signed literal
  7897. static __inline__ vector unsigned int __ATTRS_o_ai
  7898. vec_splat_u32(signed char __a) {
  7899. return (vector unsigned int)(__a);
  7900. }
  7901. /* vec_sr */
  7902. static __inline__ vector signed char __ATTRS_o_ai
  7903. vec_sr(vector signed char __a, vector unsigned char __b) {
  7904. vector unsigned char __res = (vector unsigned char)__a >> __b;
  7905. return (vector signed char)__res;
  7906. }
  7907. static __inline__ vector unsigned char __ATTRS_o_ai
  7908. vec_sr(vector unsigned char __a, vector unsigned char __b) {
  7909. return __a >> __b;
  7910. }
  7911. static __inline__ vector signed short __ATTRS_o_ai
  7912. vec_sr(vector signed short __a, vector unsigned short __b) {
  7913. vector unsigned short __res = (vector unsigned short)__a >> __b;
  7914. return (vector signed short)__res;
  7915. }
  7916. static __inline__ vector unsigned short __ATTRS_o_ai
  7917. vec_sr(vector unsigned short __a, vector unsigned short __b) {
  7918. return __a >> __b;
  7919. }
  7920. static __inline__ vector signed int __ATTRS_o_ai
  7921. vec_sr(vector signed int __a, vector unsigned int __b) {
  7922. vector unsigned int __res = (vector unsigned int)__a >> __b;
  7923. return (vector signed int)__res;
  7924. }
  7925. static __inline__ vector unsigned int __ATTRS_o_ai
  7926. vec_sr(vector unsigned int __a, vector unsigned int __b) {
  7927. return __a >> __b;
  7928. }
  7929. #ifdef __POWER8_VECTOR__
  7930. static __inline__ vector signed long long __ATTRS_o_ai
  7931. vec_sr(vector signed long long __a, vector unsigned long long __b) {
  7932. vector unsigned long long __res = (vector unsigned long long)__a >> __b;
  7933. return (vector signed long long)__res;
  7934. }
  7935. static __inline__ vector unsigned long long __ATTRS_o_ai
  7936. vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
  7937. return __a >> __b;
  7938. }
  7939. #endif
  7940. /* vec_vsrb */
  7941. #define __builtin_altivec_vsrb vec_vsrb
  7942. static __inline__ vector signed char __ATTRS_o_ai
  7943. vec_vsrb(vector signed char __a, vector unsigned char __b) {
  7944. return __a >> (vector signed char)__b;
  7945. }
  7946. static __inline__ vector unsigned char __ATTRS_o_ai
  7947. vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
  7948. return __a >> __b;
  7949. }
  7950. /* vec_vsrh */
  7951. #define __builtin_altivec_vsrh vec_vsrh
  7952. static __inline__ vector short __ATTRS_o_ai
  7953. vec_vsrh(vector short __a, vector unsigned short __b) {
  7954. return __a >> (vector short)__b;
  7955. }
  7956. static __inline__ vector unsigned short __ATTRS_o_ai
  7957. vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
  7958. return __a >> __b;
  7959. }
  7960. /* vec_vsrw */
  7961. #define __builtin_altivec_vsrw vec_vsrw
  7962. static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
  7963. vector unsigned int __b) {
  7964. return __a >> (vector int)__b;
  7965. }
  7966. static __inline__ vector unsigned int __ATTRS_o_ai
  7967. vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
  7968. return __a >> __b;
  7969. }
  7970. /* vec_sra */
  7971. static __inline__ vector signed char __ATTRS_o_ai
  7972. vec_sra(vector signed char __a, vector unsigned char __b) {
  7973. return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
  7974. }
  7975. static __inline__ vector unsigned char __ATTRS_o_ai
  7976. vec_sra(vector unsigned char __a, vector unsigned char __b) {
  7977. return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
  7978. }
  7979. static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
  7980. vector unsigned short __b) {
  7981. return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
  7982. }
  7983. static __inline__ vector unsigned short __ATTRS_o_ai
  7984. vec_sra(vector unsigned short __a, vector unsigned short __b) {
  7985. return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
  7986. }
  7987. static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
  7988. vector unsigned int __b) {
  7989. return __builtin_altivec_vsraw(__a, __b);
  7990. }
  7991. static __inline__ vector unsigned int __ATTRS_o_ai
  7992. vec_sra(vector unsigned int __a, vector unsigned int __b) {
  7993. return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
  7994. }
  7995. #ifdef __POWER8_VECTOR__
  7996. static __inline__ vector signed long long __ATTRS_o_ai
  7997. vec_sra(vector signed long long __a, vector unsigned long long __b) {
  7998. return __a >> __b;
  7999. }
  8000. static __inline__ vector unsigned long long __ATTRS_o_ai
  8001. vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
  8002. return (vector unsigned long long)((vector signed long long)__a >> __b);
  8003. }
  8004. #endif
  8005. /* vec_vsrab */
  8006. static __inline__ vector signed char __ATTRS_o_ai
  8007. vec_vsrab(vector signed char __a, vector unsigned char __b) {
  8008. return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
  8009. }
  8010. static __inline__ vector unsigned char __ATTRS_o_ai
  8011. vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
  8012. return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
  8013. }
  8014. /* vec_vsrah */
  8015. static __inline__ vector short __ATTRS_o_ai
  8016. vec_vsrah(vector short __a, vector unsigned short __b) {
  8017. return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
  8018. }
  8019. static __inline__ vector unsigned short __ATTRS_o_ai
  8020. vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
  8021. return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
  8022. }
  8023. /* vec_vsraw */
  8024. static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
  8025. vector unsigned int __b) {
  8026. return __builtin_altivec_vsraw(__a, __b);
  8027. }
  8028. static __inline__ vector unsigned int __ATTRS_o_ai
  8029. vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
  8030. return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
  8031. }
  8032. /* vec_srl */
  8033. static __inline__ vector signed char __ATTRS_o_ai
  8034. vec_srl(vector signed char __a, vector unsigned char __b) {
  8035. return (vector signed char)__builtin_altivec_vsr((vector int)__a,
  8036. (vector int)__b);
  8037. }
  8038. static __inline__ vector signed char __ATTRS_o_ai
  8039. vec_srl(vector signed char __a, vector unsigned short __b) {
  8040. return (vector signed char)__builtin_altivec_vsr((vector int)__a,
  8041. (vector int)__b);
  8042. }
  8043. static __inline__ vector signed char __ATTRS_o_ai
  8044. vec_srl(vector signed char __a, vector unsigned int __b) {
  8045. return (vector signed char)__builtin_altivec_vsr((vector int)__a,
  8046. (vector int)__b);
  8047. }
  8048. static __inline__ vector unsigned char __ATTRS_o_ai
  8049. vec_srl(vector unsigned char __a, vector unsigned char __b) {
  8050. return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
  8051. (vector int)__b);
  8052. }
  8053. static __inline__ vector unsigned char __ATTRS_o_ai
  8054. vec_srl(vector unsigned char __a, vector unsigned short __b) {
  8055. return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
  8056. (vector int)__b);
  8057. }
  8058. static __inline__ vector unsigned char __ATTRS_o_ai
  8059. vec_srl(vector unsigned char __a, vector unsigned int __b) {
  8060. return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
  8061. (vector int)__b);
  8062. }
  8063. static __inline__ vector bool char __ATTRS_o_ai
  8064. vec_srl(vector bool char __a, vector unsigned char __b) {
  8065. return (vector bool char)__builtin_altivec_vsr((vector int)__a,
  8066. (vector int)__b);
  8067. }
  8068. static __inline__ vector bool char __ATTRS_o_ai
  8069. vec_srl(vector bool char __a, vector unsigned short __b) {
  8070. return (vector bool char)__builtin_altivec_vsr((vector int)__a,
  8071. (vector int)__b);
  8072. }
  8073. static __inline__ vector bool char __ATTRS_o_ai
  8074. vec_srl(vector bool char __a, vector unsigned int __b) {
  8075. return (vector bool char)__builtin_altivec_vsr((vector int)__a,
  8076. (vector int)__b);
  8077. }
  8078. static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
  8079. vector unsigned char __b) {
  8080. return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8081. }
  8082. static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
  8083. vector unsigned short __b) {
  8084. return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8085. }
  8086. static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
  8087. vector unsigned int __b) {
  8088. return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8089. }
  8090. static __inline__ vector unsigned short __ATTRS_o_ai
  8091. vec_srl(vector unsigned short __a, vector unsigned char __b) {
  8092. return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
  8093. (vector int)__b);
  8094. }
  8095. static __inline__ vector unsigned short __ATTRS_o_ai
  8096. vec_srl(vector unsigned short __a, vector unsigned short __b) {
  8097. return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
  8098. (vector int)__b);
  8099. }
  8100. static __inline__ vector unsigned short __ATTRS_o_ai
  8101. vec_srl(vector unsigned short __a, vector unsigned int __b) {
  8102. return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
  8103. (vector int)__b);
  8104. }
  8105. static __inline__ vector bool short __ATTRS_o_ai
  8106. vec_srl(vector bool short __a, vector unsigned char __b) {
  8107. return (vector bool short)__builtin_altivec_vsr((vector int)__a,
  8108. (vector int)__b);
  8109. }
  8110. static __inline__ vector bool short __ATTRS_o_ai
  8111. vec_srl(vector bool short __a, vector unsigned short __b) {
  8112. return (vector bool short)__builtin_altivec_vsr((vector int)__a,
  8113. (vector int)__b);
  8114. }
  8115. static __inline__ vector bool short __ATTRS_o_ai
  8116. vec_srl(vector bool short __a, vector unsigned int __b) {
  8117. return (vector bool short)__builtin_altivec_vsr((vector int)__a,
  8118. (vector int)__b);
  8119. }
  8120. static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
  8121. vector unsigned char __b) {
  8122. return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8123. }
  8124. static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
  8125. vector unsigned short __b) {
  8126. return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8127. }
  8128. static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
  8129. vector unsigned int __b) {
  8130. return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8131. }
  8132. static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
  8133. vector unsigned char __b) {
  8134. return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
  8135. }
  8136. static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
  8137. vector unsigned short __b) {
  8138. return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
  8139. }
  8140. static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
  8141. vector unsigned int __b) {
  8142. return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
  8143. }
  8144. static __inline__ vector unsigned int __ATTRS_o_ai
  8145. vec_srl(vector unsigned int __a, vector unsigned char __b) {
  8146. return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
  8147. (vector int)__b);
  8148. }
  8149. static __inline__ vector unsigned int __ATTRS_o_ai
  8150. vec_srl(vector unsigned int __a, vector unsigned short __b) {
  8151. return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
  8152. (vector int)__b);
  8153. }
  8154. static __inline__ vector unsigned int __ATTRS_o_ai
  8155. vec_srl(vector unsigned int __a, vector unsigned int __b) {
  8156. return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
  8157. (vector int)__b);
  8158. }
  8159. static __inline__ vector bool int __ATTRS_o_ai
  8160. vec_srl(vector bool int __a, vector unsigned char __b) {
  8161. return (vector bool int)__builtin_altivec_vsr((vector int)__a,
  8162. (vector int)__b);
  8163. }
  8164. static __inline__ vector bool int __ATTRS_o_ai
  8165. vec_srl(vector bool int __a, vector unsigned short __b) {
  8166. return (vector bool int)__builtin_altivec_vsr((vector int)__a,
  8167. (vector int)__b);
  8168. }
  8169. static __inline__ vector bool int __ATTRS_o_ai
  8170. vec_srl(vector bool int __a, vector unsigned int __b) {
  8171. return (vector bool int)__builtin_altivec_vsr((vector int)__a,
  8172. (vector int)__b);
  8173. }
  8174. #ifdef __VSX__
  8175. static __inline__ vector signed long long __ATTRS_o_ai
  8176. vec_srl(vector signed long long __a, vector unsigned char __b) {
  8177. return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
  8178. (vector int)__b);
  8179. }
  8180. static __inline__ vector unsigned long long __ATTRS_o_ai
  8181. vec_srl(vector unsigned long long __a, vector unsigned char __b) {
  8182. return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
  8183. (vector int)__b);
  8184. }
  8185. #endif
  8186. /* vec_vsr */
  8187. static __inline__ vector signed char __ATTRS_o_ai
  8188. vec_vsr(vector signed char __a, vector unsigned char __b) {
  8189. return (vector signed char)__builtin_altivec_vsr((vector int)__a,
  8190. (vector int)__b);
  8191. }
  8192. static __inline__ vector signed char __ATTRS_o_ai
  8193. vec_vsr(vector signed char __a, vector unsigned short __b) {
  8194. return (vector signed char)__builtin_altivec_vsr((vector int)__a,
  8195. (vector int)__b);
  8196. }
  8197. static __inline__ vector signed char __ATTRS_o_ai
  8198. vec_vsr(vector signed char __a, vector unsigned int __b) {
  8199. return (vector signed char)__builtin_altivec_vsr((vector int)__a,
  8200. (vector int)__b);
  8201. }
  8202. static __inline__ vector unsigned char __ATTRS_o_ai
  8203. vec_vsr(vector unsigned char __a, vector unsigned char __b) {
  8204. return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
  8205. (vector int)__b);
  8206. }
  8207. static __inline__ vector unsigned char __ATTRS_o_ai
  8208. vec_vsr(vector unsigned char __a, vector unsigned short __b) {
  8209. return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
  8210. (vector int)__b);
  8211. }
  8212. static __inline__ vector unsigned char __ATTRS_o_ai
  8213. vec_vsr(vector unsigned char __a, vector unsigned int __b) {
  8214. return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
  8215. (vector int)__b);
  8216. }
  8217. static __inline__ vector bool char __ATTRS_o_ai
  8218. vec_vsr(vector bool char __a, vector unsigned char __b) {
  8219. return (vector bool char)__builtin_altivec_vsr((vector int)__a,
  8220. (vector int)__b);
  8221. }
  8222. static __inline__ vector bool char __ATTRS_o_ai
  8223. vec_vsr(vector bool char __a, vector unsigned short __b) {
  8224. return (vector bool char)__builtin_altivec_vsr((vector int)__a,
  8225. (vector int)__b);
  8226. }
  8227. static __inline__ vector bool char __ATTRS_o_ai
  8228. vec_vsr(vector bool char __a, vector unsigned int __b) {
  8229. return (vector bool char)__builtin_altivec_vsr((vector int)__a,
  8230. (vector int)__b);
  8231. }
  8232. static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
  8233. vector unsigned char __b) {
  8234. return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8235. }
  8236. static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
  8237. vector unsigned short __b) {
  8238. return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8239. }
  8240. static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
  8241. vector unsigned int __b) {
  8242. return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8243. }
  8244. static __inline__ vector unsigned short __ATTRS_o_ai
  8245. vec_vsr(vector unsigned short __a, vector unsigned char __b) {
  8246. return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
  8247. (vector int)__b);
  8248. }
  8249. static __inline__ vector unsigned short __ATTRS_o_ai
  8250. vec_vsr(vector unsigned short __a, vector unsigned short __b) {
  8251. return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
  8252. (vector int)__b);
  8253. }
  8254. static __inline__ vector unsigned short __ATTRS_o_ai
  8255. vec_vsr(vector unsigned short __a, vector unsigned int __b) {
  8256. return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
  8257. (vector int)__b);
  8258. }
  8259. static __inline__ vector bool short __ATTRS_o_ai
  8260. vec_vsr(vector bool short __a, vector unsigned char __b) {
  8261. return (vector bool short)__builtin_altivec_vsr((vector int)__a,
  8262. (vector int)__b);
  8263. }
  8264. static __inline__ vector bool short __ATTRS_o_ai
  8265. vec_vsr(vector bool short __a, vector unsigned short __b) {
  8266. return (vector bool short)__builtin_altivec_vsr((vector int)__a,
  8267. (vector int)__b);
  8268. }
  8269. static __inline__ vector bool short __ATTRS_o_ai
  8270. vec_vsr(vector bool short __a, vector unsigned int __b) {
  8271. return (vector bool short)__builtin_altivec_vsr((vector int)__a,
  8272. (vector int)__b);
  8273. }
  8274. static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
  8275. vector unsigned char __b) {
  8276. return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8277. }
  8278. static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
  8279. vector unsigned short __b) {
  8280. return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8281. }
  8282. static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
  8283. vector unsigned int __b) {
  8284. return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
  8285. }
  8286. static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
  8287. vector unsigned char __b) {
  8288. return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
  8289. }
  8290. static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
  8291. vector unsigned short __b) {
  8292. return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
  8293. }
  8294. static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
  8295. vector unsigned int __b) {
  8296. return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
  8297. }
  8298. static __inline__ vector unsigned int __ATTRS_o_ai
  8299. vec_vsr(vector unsigned int __a, vector unsigned char __b) {
  8300. return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
  8301. (vector int)__b);
  8302. }
  8303. static __inline__ vector unsigned int __ATTRS_o_ai
  8304. vec_vsr(vector unsigned int __a, vector unsigned short __b) {
  8305. return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
  8306. (vector int)__b);
  8307. }
  8308. static __inline__ vector unsigned int __ATTRS_o_ai
  8309. vec_vsr(vector unsigned int __a, vector unsigned int __b) {
  8310. return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
  8311. (vector int)__b);
  8312. }
  8313. static __inline__ vector bool int __ATTRS_o_ai
  8314. vec_vsr(vector bool int __a, vector unsigned char __b) {
  8315. return (vector bool int)__builtin_altivec_vsr((vector int)__a,
  8316. (vector int)__b);
  8317. }
  8318. static __inline__ vector bool int __ATTRS_o_ai
  8319. vec_vsr(vector bool int __a, vector unsigned short __b) {
  8320. return (vector bool int)__builtin_altivec_vsr((vector int)__a,
  8321. (vector int)__b);
  8322. }
  8323. static __inline__ vector bool int __ATTRS_o_ai
  8324. vec_vsr(vector bool int __a, vector unsigned int __b) {
  8325. return (vector bool int)__builtin_altivec_vsr((vector int)__a,
  8326. (vector int)__b);
  8327. }
  8328. /* vec_sro */
  8329. static __inline__ vector signed char __ATTRS_o_ai
  8330. vec_sro(vector signed char __a, vector signed char __b) {
  8331. return (vector signed char)__builtin_altivec_vsro((vector int)__a,
  8332. (vector int)__b);
  8333. }
  8334. static __inline__ vector signed char __ATTRS_o_ai
  8335. vec_sro(vector signed char __a, vector unsigned char __b) {
  8336. return (vector signed char)__builtin_altivec_vsro((vector int)__a,
  8337. (vector int)__b);
  8338. }
  8339. static __inline__ vector unsigned char __ATTRS_o_ai
  8340. vec_sro(vector unsigned char __a, vector signed char __b) {
  8341. return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
  8342. (vector int)__b);
  8343. }
  8344. static __inline__ vector unsigned char __ATTRS_o_ai
  8345. vec_sro(vector unsigned char __a, vector unsigned char __b) {
  8346. return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
  8347. (vector int)__b);
  8348. }
  8349. static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
  8350. vector signed char __b) {
  8351. return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8352. }
  8353. static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
  8354. vector unsigned char __b) {
  8355. return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8356. }
  8357. static __inline__ vector unsigned short __ATTRS_o_ai
  8358. vec_sro(vector unsigned short __a, vector signed char __b) {
  8359. return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
  8360. (vector int)__b);
  8361. }
  8362. static __inline__ vector unsigned short __ATTRS_o_ai
  8363. vec_sro(vector unsigned short __a, vector unsigned char __b) {
  8364. return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
  8365. (vector int)__b);
  8366. }
  8367. static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
  8368. vector signed char __b) {
  8369. return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8370. }
  8371. static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
  8372. vector unsigned char __b) {
  8373. return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8374. }
  8375. static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
  8376. vector signed char __b) {
  8377. return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
  8378. }
  8379. static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
  8380. vector unsigned char __b) {
  8381. return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
  8382. }
  8383. static __inline__ vector unsigned int __ATTRS_o_ai
  8384. vec_sro(vector unsigned int __a, vector signed char __b) {
  8385. return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
  8386. (vector int)__b);
  8387. }
  8388. static __inline__ vector unsigned int __ATTRS_o_ai
  8389. vec_sro(vector unsigned int __a, vector unsigned char __b) {
  8390. return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
  8391. (vector int)__b);
  8392. }
  8393. static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
  8394. vector signed char __b) {
  8395. return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8396. }
  8397. static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
  8398. vector unsigned char __b) {
  8399. return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8400. }
  8401. #ifdef __VSX__
  8402. static __inline__ vector signed long long __ATTRS_o_ai
  8403. vec_sro(vector signed long long __a, vector signed char __b) {
  8404. return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
  8405. (vector int)__b);
  8406. }
  8407. static __inline__ vector signed long long __ATTRS_o_ai
  8408. vec_sro(vector signed long long __a, vector unsigned char __b) {
  8409. return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
  8410. (vector int)__b);
  8411. }
  8412. static __inline__ vector unsigned long long __ATTRS_o_ai
  8413. vec_sro(vector unsigned long long __a, vector signed char __b) {
  8414. return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
  8415. (vector int)__b);
  8416. }
  8417. static __inline__ vector unsigned long long __ATTRS_o_ai
  8418. vec_sro(vector unsigned long long __a, vector unsigned char __b) {
  8419. return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
  8420. (vector int)__b);
  8421. }
  8422. #endif
  8423. /* vec_vsro */
  8424. static __inline__ vector signed char __ATTRS_o_ai
  8425. vec_vsro(vector signed char __a, vector signed char __b) {
  8426. return (vector signed char)__builtin_altivec_vsro((vector int)__a,
  8427. (vector int)__b);
  8428. }
  8429. static __inline__ vector signed char __ATTRS_o_ai
  8430. vec_vsro(vector signed char __a, vector unsigned char __b) {
  8431. return (vector signed char)__builtin_altivec_vsro((vector int)__a,
  8432. (vector int)__b);
  8433. }
  8434. static __inline__ vector unsigned char __ATTRS_o_ai
  8435. vec_vsro(vector unsigned char __a, vector signed char __b) {
  8436. return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
  8437. (vector int)__b);
  8438. }
  8439. static __inline__ vector unsigned char __ATTRS_o_ai
  8440. vec_vsro(vector unsigned char __a, vector unsigned char __b) {
  8441. return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
  8442. (vector int)__b);
  8443. }
  8444. static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
  8445. vector signed char __b) {
  8446. return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8447. }
  8448. static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
  8449. vector unsigned char __b) {
  8450. return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8451. }
  8452. static __inline__ vector unsigned short __ATTRS_o_ai
  8453. vec_vsro(vector unsigned short __a, vector signed char __b) {
  8454. return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
  8455. (vector int)__b);
  8456. }
  8457. static __inline__ vector unsigned short __ATTRS_o_ai
  8458. vec_vsro(vector unsigned short __a, vector unsigned char __b) {
  8459. return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
  8460. (vector int)__b);
  8461. }
  8462. static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
  8463. vector signed char __b) {
  8464. return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8465. }
  8466. static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
  8467. vector unsigned char __b) {
  8468. return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8469. }
  8470. static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
  8471. vector signed char __b) {
  8472. return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
  8473. }
  8474. static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
  8475. vector unsigned char __b) {
  8476. return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
  8477. }
  8478. static __inline__ vector unsigned int __ATTRS_o_ai
  8479. vec_vsro(vector unsigned int __a, vector signed char __b) {
  8480. return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
  8481. (vector int)__b);
  8482. }
  8483. static __inline__ vector unsigned int __ATTRS_o_ai
  8484. vec_vsro(vector unsigned int __a, vector unsigned char __b) {
  8485. return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
  8486. (vector int)__b);
  8487. }
  8488. static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
  8489. vector signed char __b) {
  8490. return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8491. }
  8492. static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
  8493. vector unsigned char __b) {
  8494. return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
  8495. }
  8496. /* vec_st */
  8497. static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
  8498. vector signed char *__c) {
  8499. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8500. }
  8501. static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b,
  8502. signed char *__c) {
  8503. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8504. }
  8505. static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
  8506. vector unsigned char *__c) {
  8507. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8508. }
  8509. static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b,
  8510. unsigned char *__c) {
  8511. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8512. }
  8513. static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
  8514. signed char *__c) {
  8515. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8516. }
  8517. static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
  8518. unsigned char *__c) {
  8519. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8520. }
  8521. static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b,
  8522. vector bool char *__c) {
  8523. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8524. }
  8525. static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
  8526. vector short *__c) {
  8527. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8528. }
  8529. static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b,
  8530. short *__c) {
  8531. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8532. }
  8533. static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
  8534. vector unsigned short *__c) {
  8535. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8536. }
  8537. static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b,
  8538. unsigned short *__c) {
  8539. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8540. }
  8541. static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
  8542. short *__c) {
  8543. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8544. }
  8545. static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
  8546. unsigned short *__c) {
  8547. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8548. }
  8549. static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b,
  8550. vector bool short *__c) {
  8551. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8552. }
  8553. static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
  8554. short *__c) {
  8555. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8556. }
  8557. static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
  8558. unsigned short *__c) {
  8559. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8560. }
  8561. static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b,
  8562. vector pixel *__c) {
  8563. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8564. }
  8565. static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b,
  8566. vector int *__c) {
  8567. __builtin_altivec_stvx(__a, __b, __c);
  8568. }
  8569. static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) {
  8570. __builtin_altivec_stvx(__a, __b, __c);
  8571. }
  8572. static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
  8573. vector unsigned int *__c) {
  8574. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8575. }
  8576. static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b,
  8577. unsigned int *__c) {
  8578. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8579. }
  8580. static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
  8581. int *__c) {
  8582. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8583. }
  8584. static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
  8585. unsigned int *__c) {
  8586. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8587. }
  8588. static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b,
  8589. vector bool int *__c) {
  8590. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8591. }
  8592. static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
  8593. vector float *__c) {
  8594. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8595. }
  8596. static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b,
  8597. float *__c) {
  8598. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8599. }
  8600. /* vec_stvx */
  8601. static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
  8602. vector signed char *__c) {
  8603. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8604. }
  8605. static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b,
  8606. signed char *__c) {
  8607. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8608. }
  8609. static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
  8610. vector unsigned char *__c) {
  8611. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8612. }
  8613. static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b,
  8614. unsigned char *__c) {
  8615. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8616. }
  8617. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
  8618. signed char *__c) {
  8619. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8620. }
  8621. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
  8622. unsigned char *__c) {
  8623. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8624. }
  8625. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b,
  8626. vector bool char *__c) {
  8627. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8628. }
  8629. static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
  8630. vector short *__c) {
  8631. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8632. }
  8633. static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b,
  8634. short *__c) {
  8635. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8636. }
  8637. static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
  8638. vector unsigned short *__c) {
  8639. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8640. }
  8641. static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b,
  8642. unsigned short *__c) {
  8643. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8644. }
  8645. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
  8646. short *__c) {
  8647. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8648. }
  8649. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
  8650. unsigned short *__c) {
  8651. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8652. }
  8653. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b,
  8654. vector bool short *__c) {
  8655. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8656. }
  8657. static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
  8658. short *__c) {
  8659. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8660. }
  8661. static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
  8662. unsigned short *__c) {
  8663. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8664. }
  8665. static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b,
  8666. vector pixel *__c) {
  8667. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8668. }
  8669. static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
  8670. vector int *__c) {
  8671. __builtin_altivec_stvx(__a, __b, __c);
  8672. }
  8673. static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b,
  8674. int *__c) {
  8675. __builtin_altivec_stvx(__a, __b, __c);
  8676. }
  8677. static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
  8678. vector unsigned int *__c) {
  8679. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8680. }
  8681. static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b,
  8682. unsigned int *__c) {
  8683. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8684. }
  8685. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
  8686. int *__c) {
  8687. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8688. }
  8689. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
  8690. unsigned int *__c) {
  8691. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8692. }
  8693. static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b,
  8694. vector bool int *__c) {
  8695. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8696. }
  8697. static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
  8698. vector float *__c) {
  8699. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8700. }
  8701. static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b,
  8702. float *__c) {
  8703. __builtin_altivec_stvx((vector int)__a, __b, __c);
  8704. }
  8705. /* vec_ste */
  8706. static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b,
  8707. signed char *__c) {
  8708. __builtin_altivec_stvebx((vector char)__a, __b, __c);
  8709. }
  8710. static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b,
  8711. unsigned char *__c) {
  8712. __builtin_altivec_stvebx((vector char)__a, __b, __c);
  8713. }
  8714. static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
  8715. signed char *__c) {
  8716. __builtin_altivec_stvebx((vector char)__a, __b, __c);
  8717. }
  8718. static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b,
  8719. unsigned char *__c) {
  8720. __builtin_altivec_stvebx((vector char)__a, __b, __c);
  8721. }
  8722. static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b,
  8723. short *__c) {
  8724. __builtin_altivec_stvehx(__a, __b, __c);
  8725. }
  8726. static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b,
  8727. unsigned short *__c) {
  8728. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8729. }
  8730. static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
  8731. short *__c) {
  8732. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8733. }
  8734. static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b,
  8735. unsigned short *__c) {
  8736. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8737. }
  8738. static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
  8739. short *__c) {
  8740. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8741. }
  8742. static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b,
  8743. unsigned short *__c) {
  8744. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8745. }
  8746. static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) {
  8747. __builtin_altivec_stvewx(__a, __b, __c);
  8748. }
  8749. static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b,
  8750. unsigned int *__c) {
  8751. __builtin_altivec_stvewx((vector int)__a, __b, __c);
  8752. }
  8753. static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
  8754. int *__c) {
  8755. __builtin_altivec_stvewx((vector int)__a, __b, __c);
  8756. }
  8757. static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b,
  8758. unsigned int *__c) {
  8759. __builtin_altivec_stvewx((vector int)__a, __b, __c);
  8760. }
  8761. static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b,
  8762. float *__c) {
  8763. __builtin_altivec_stvewx((vector int)__a, __b, __c);
  8764. }
  8765. /* vec_stvebx */
  8766. static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b,
  8767. signed char *__c) {
  8768. __builtin_altivec_stvebx((vector char)__a, __b, __c);
  8769. }
  8770. static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
  8771. int __b, unsigned char *__c) {
  8772. __builtin_altivec_stvebx((vector char)__a, __b, __c);
  8773. }
  8774. static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
  8775. signed char *__c) {
  8776. __builtin_altivec_stvebx((vector char)__a, __b, __c);
  8777. }
  8778. static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b,
  8779. unsigned char *__c) {
  8780. __builtin_altivec_stvebx((vector char)__a, __b, __c);
  8781. }
  8782. /* vec_stvehx */
  8783. static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b,
  8784. short *__c) {
  8785. __builtin_altivec_stvehx(__a, __b, __c);
  8786. }
  8787. static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
  8788. int __b, unsigned short *__c) {
  8789. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8790. }
  8791. static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
  8792. short *__c) {
  8793. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8794. }
  8795. static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b,
  8796. unsigned short *__c) {
  8797. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8798. }
  8799. static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
  8800. short *__c) {
  8801. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8802. }
  8803. static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b,
  8804. unsigned short *__c) {
  8805. __builtin_altivec_stvehx((vector short)__a, __b, __c);
  8806. }
  8807. /* vec_stvewx */
  8808. static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b,
  8809. int *__c) {
  8810. __builtin_altivec_stvewx(__a, __b, __c);
  8811. }
  8812. static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b,
  8813. unsigned int *__c) {
  8814. __builtin_altivec_stvewx((vector int)__a, __b, __c);
  8815. }
  8816. static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
  8817. int *__c) {
  8818. __builtin_altivec_stvewx((vector int)__a, __b, __c);
  8819. }
  8820. static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b,
  8821. unsigned int *__c) {
  8822. __builtin_altivec_stvewx((vector int)__a, __b, __c);
  8823. }
  8824. static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b,
  8825. float *__c) {
  8826. __builtin_altivec_stvewx((vector int)__a, __b, __c);
  8827. }
  8828. /* vec_stl */
  8829. static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
  8830. vector signed char *__c) {
  8831. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8832. }
  8833. static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
  8834. signed char *__c) {
  8835. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8836. }
  8837. static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
  8838. vector unsigned char *__c) {
  8839. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8840. }
  8841. static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
  8842. unsigned char *__c) {
  8843. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8844. }
  8845. static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
  8846. signed char *__c) {
  8847. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8848. }
  8849. static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
  8850. unsigned char *__c) {
  8851. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8852. }
  8853. static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
  8854. vector bool char *__c) {
  8855. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8856. }
  8857. static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
  8858. vector short *__c) {
  8859. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8860. }
  8861. static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
  8862. short *__c) {
  8863. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8864. }
  8865. static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
  8866. vector unsigned short *__c) {
  8867. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8868. }
  8869. static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
  8870. unsigned short *__c) {
  8871. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8872. }
  8873. static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
  8874. short *__c) {
  8875. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8876. }
  8877. static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
  8878. unsigned short *__c) {
  8879. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8880. }
  8881. static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
  8882. vector bool short *__c) {
  8883. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8884. }
  8885. static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
  8886. short *__c) {
  8887. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8888. }
  8889. static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
  8890. unsigned short *__c) {
  8891. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8892. }
  8893. static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
  8894. vector pixel *__c) {
  8895. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8896. }
  8897. static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
  8898. vector int *__c) {
  8899. __builtin_altivec_stvxl(__a, __b, __c);
  8900. }
  8901. static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
  8902. __builtin_altivec_stvxl(__a, __b, __c);
  8903. }
  8904. static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
  8905. vector unsigned int *__c) {
  8906. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8907. }
  8908. static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
  8909. unsigned int *__c) {
  8910. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8911. }
  8912. static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
  8913. int *__c) {
  8914. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8915. }
  8916. static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
  8917. unsigned int *__c) {
  8918. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8919. }
  8920. static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
  8921. vector bool int *__c) {
  8922. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8923. }
  8924. static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
  8925. vector float *__c) {
  8926. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8927. }
  8928. static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
  8929. float *__c) {
  8930. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8931. }
  8932. /* vec_stvxl */
  8933. static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
  8934. vector signed char *__c) {
  8935. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8936. }
  8937. static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
  8938. signed char *__c) {
  8939. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8940. }
  8941. static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
  8942. vector unsigned char *__c) {
  8943. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8944. }
  8945. static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
  8946. unsigned char *__c) {
  8947. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8948. }
  8949. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
  8950. signed char *__c) {
  8951. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8952. }
  8953. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
  8954. unsigned char *__c) {
  8955. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8956. }
  8957. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
  8958. vector bool char *__c) {
  8959. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8960. }
  8961. static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
  8962. vector short *__c) {
  8963. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8964. }
  8965. static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
  8966. short *__c) {
  8967. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8968. }
  8969. static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
  8970. int __b,
  8971. vector unsigned short *__c) {
  8972. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8973. }
  8974. static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
  8975. int __b, unsigned short *__c) {
  8976. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8977. }
  8978. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
  8979. short *__c) {
  8980. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8981. }
  8982. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
  8983. unsigned short *__c) {
  8984. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8985. }
  8986. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
  8987. vector bool short *__c) {
  8988. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8989. }
  8990. static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
  8991. short *__c) {
  8992. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8993. }
  8994. static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
  8995. unsigned short *__c) {
  8996. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  8997. }
  8998. static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
  8999. vector pixel *__c) {
  9000. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  9001. }
  9002. static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
  9003. vector int *__c) {
  9004. __builtin_altivec_stvxl(__a, __b, __c);
  9005. }
  9006. static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
  9007. int *__c) {
  9008. __builtin_altivec_stvxl(__a, __b, __c);
  9009. }
  9010. static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
  9011. vector unsigned int *__c) {
  9012. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  9013. }
  9014. static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
  9015. unsigned int *__c) {
  9016. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  9017. }
  9018. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
  9019. int *__c) {
  9020. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  9021. }
  9022. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
  9023. unsigned int *__c) {
  9024. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  9025. }
  9026. static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
  9027. vector bool int *__c) {
  9028. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  9029. }
  9030. static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
  9031. vector float *__c) {
  9032. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  9033. }
  9034. static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
  9035. float *__c) {
  9036. __builtin_altivec_stvxl((vector int)__a, __b, __c);
  9037. }
  9038. /* vec_sub */
  9039. static __inline__ vector signed char __ATTRS_o_ai
  9040. vec_sub(vector signed char __a, vector signed char __b) {
  9041. return __a - __b;
  9042. }
  9043. static __inline__ vector signed char __ATTRS_o_ai
  9044. vec_sub(vector bool char __a, vector signed char __b) {
  9045. return (vector signed char)__a - __b;
  9046. }
  9047. static __inline__ vector signed char __ATTRS_o_ai
  9048. vec_sub(vector signed char __a, vector bool char __b) {
  9049. return __a - (vector signed char)__b;
  9050. }
  9051. static __inline__ vector unsigned char __ATTRS_o_ai
  9052. vec_sub(vector unsigned char __a, vector unsigned char __b) {
  9053. return __a - __b;
  9054. }
  9055. static __inline__ vector unsigned char __ATTRS_o_ai
  9056. vec_sub(vector bool char __a, vector unsigned char __b) {
  9057. return (vector unsigned char)__a - __b;
  9058. }
  9059. static __inline__ vector unsigned char __ATTRS_o_ai
  9060. vec_sub(vector unsigned char __a, vector bool char __b) {
  9061. return __a - (vector unsigned char)__b;
  9062. }
  9063. static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
  9064. vector short __b) {
  9065. return __a - __b;
  9066. }
  9067. static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
  9068. vector short __b) {
  9069. return (vector short)__a - __b;
  9070. }
  9071. static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
  9072. vector bool short __b) {
  9073. return __a - (vector short)__b;
  9074. }
  9075. static __inline__ vector unsigned short __ATTRS_o_ai
  9076. vec_sub(vector unsigned short __a, vector unsigned short __b) {
  9077. return __a - __b;
  9078. }
  9079. static __inline__ vector unsigned short __ATTRS_o_ai
  9080. vec_sub(vector bool short __a, vector unsigned short __b) {
  9081. return (vector unsigned short)__a - __b;
  9082. }
  9083. static __inline__ vector unsigned short __ATTRS_o_ai
  9084. vec_sub(vector unsigned short __a, vector bool short __b) {
  9085. return __a - (vector unsigned short)__b;
  9086. }
  9087. static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
  9088. vector int __b) {
  9089. return __a - __b;
  9090. }
  9091. static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
  9092. vector int __b) {
  9093. return (vector int)__a - __b;
  9094. }
  9095. static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
  9096. vector bool int __b) {
  9097. return __a - (vector int)__b;
  9098. }
  9099. static __inline__ vector unsigned int __ATTRS_o_ai
  9100. vec_sub(vector unsigned int __a, vector unsigned int __b) {
  9101. return __a - __b;
  9102. }
  9103. static __inline__ vector unsigned int __ATTRS_o_ai
  9104. vec_sub(vector bool int __a, vector unsigned int __b) {
  9105. return (vector unsigned int)__a - __b;
  9106. }
  9107. static __inline__ vector unsigned int __ATTRS_o_ai
  9108. vec_sub(vector unsigned int __a, vector bool int __b) {
  9109. return __a - (vector unsigned int)__b;
  9110. }
  9111. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  9112. static __inline__ vector signed __int128 __ATTRS_o_ai
  9113. vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
  9114. return __a - __b;
  9115. }
  9116. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  9117. vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
  9118. return __a - __b;
  9119. }
  9120. #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  9121. #ifdef __VSX__
  9122. static __inline__ vector signed long long __ATTRS_o_ai
  9123. vec_sub(vector signed long long __a, vector signed long long __b) {
  9124. return __a - __b;
  9125. }
  9126. static __inline__ vector unsigned long long __ATTRS_o_ai
  9127. vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
  9128. return __a - __b;
  9129. }
  9130. static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
  9131. vector double __b) {
  9132. return __a - __b;
  9133. }
  9134. #endif
  9135. static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
  9136. vector float __b) {
  9137. return __a - __b;
  9138. }
  9139. /* vec_vsububm */
  9140. #define __builtin_altivec_vsububm vec_vsububm
  9141. static __inline__ vector signed char __ATTRS_o_ai
  9142. vec_vsububm(vector signed char __a, vector signed char __b) {
  9143. return __a - __b;
  9144. }
  9145. static __inline__ vector signed char __ATTRS_o_ai
  9146. vec_vsububm(vector bool char __a, vector signed char __b) {
  9147. return (vector signed char)__a - __b;
  9148. }
  9149. static __inline__ vector signed char __ATTRS_o_ai
  9150. vec_vsububm(vector signed char __a, vector bool char __b) {
  9151. return __a - (vector signed char)__b;
  9152. }
  9153. static __inline__ vector unsigned char __ATTRS_o_ai
  9154. vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
  9155. return __a - __b;
  9156. }
  9157. static __inline__ vector unsigned char __ATTRS_o_ai
  9158. vec_vsububm(vector bool char __a, vector unsigned char __b) {
  9159. return (vector unsigned char)__a - __b;
  9160. }
  9161. static __inline__ vector unsigned char __ATTRS_o_ai
  9162. vec_vsububm(vector unsigned char __a, vector bool char __b) {
  9163. return __a - (vector unsigned char)__b;
  9164. }
  9165. /* vec_vsubuhm */
  9166. #define __builtin_altivec_vsubuhm vec_vsubuhm
  9167. static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
  9168. vector short __b) {
  9169. return __a - __b;
  9170. }
  9171. static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
  9172. vector short __b) {
  9173. return (vector short)__a - __b;
  9174. }
  9175. static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
  9176. vector bool short __b) {
  9177. return __a - (vector short)__b;
  9178. }
  9179. static __inline__ vector unsigned short __ATTRS_o_ai
  9180. vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
  9181. return __a - __b;
  9182. }
  9183. static __inline__ vector unsigned short __ATTRS_o_ai
  9184. vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
  9185. return (vector unsigned short)__a - __b;
  9186. }
  9187. static __inline__ vector unsigned short __ATTRS_o_ai
  9188. vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
  9189. return __a - (vector unsigned short)__b;
  9190. }
  9191. /* vec_vsubuwm */
  9192. #define __builtin_altivec_vsubuwm vec_vsubuwm
  9193. static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
  9194. vector int __b) {
  9195. return __a - __b;
  9196. }
  9197. static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
  9198. vector int __b) {
  9199. return (vector int)__a - __b;
  9200. }
  9201. static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
  9202. vector bool int __b) {
  9203. return __a - (vector int)__b;
  9204. }
  9205. static __inline__ vector unsigned int __ATTRS_o_ai
  9206. vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
  9207. return __a - __b;
  9208. }
  9209. static __inline__ vector unsigned int __ATTRS_o_ai
  9210. vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
  9211. return (vector unsigned int)__a - __b;
  9212. }
  9213. static __inline__ vector unsigned int __ATTRS_o_ai
  9214. vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
  9215. return __a - (vector unsigned int)__b;
  9216. }
  9217. /* vec_vsubfp */
  9218. #define __builtin_altivec_vsubfp vec_vsubfp
  9219. static __inline__ vector float __attribute__((__always_inline__))
  9220. vec_vsubfp(vector float __a, vector float __b) {
  9221. return __a - __b;
  9222. }
  9223. /* vec_subc */
  9224. static __inline__ vector signed int __ATTRS_o_ai
  9225. vec_subc(vector signed int __a, vector signed int __b) {
  9226. return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
  9227. (vector unsigned int) __b);
  9228. }
  9229. static __inline__ vector unsigned int __ATTRS_o_ai
  9230. vec_subc(vector unsigned int __a, vector unsigned int __b) {
  9231. return __builtin_altivec_vsubcuw(__a, __b);
  9232. }
  9233. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  9234. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  9235. vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
  9236. return __builtin_altivec_vsubcuq(__a, __b);
  9237. }
  9238. static __inline__ vector signed __int128 __ATTRS_o_ai
  9239. vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
  9240. return __builtin_altivec_vsubcuq(__a, __b);
  9241. }
  9242. #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  9243. /* vec_vsubcuw */
  9244. static __inline__ vector unsigned int __attribute__((__always_inline__))
  9245. vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
  9246. return __builtin_altivec_vsubcuw(__a, __b);
  9247. }
  9248. /* vec_subs */
  9249. static __inline__ vector signed char __ATTRS_o_ai
  9250. vec_subs(vector signed char __a, vector signed char __b) {
  9251. return __builtin_altivec_vsubsbs(__a, __b);
  9252. }
  9253. static __inline__ vector signed char __ATTRS_o_ai
  9254. vec_subs(vector bool char __a, vector signed char __b) {
  9255. return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
  9256. }
  9257. static __inline__ vector signed char __ATTRS_o_ai
  9258. vec_subs(vector signed char __a, vector bool char __b) {
  9259. return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
  9260. }
  9261. static __inline__ vector unsigned char __ATTRS_o_ai
  9262. vec_subs(vector unsigned char __a, vector unsigned char __b) {
  9263. return __builtin_altivec_vsububs(__a, __b);
  9264. }
  9265. static __inline__ vector unsigned char __ATTRS_o_ai
  9266. vec_subs(vector bool char __a, vector unsigned char __b) {
  9267. return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
  9268. }
  9269. static __inline__ vector unsigned char __ATTRS_o_ai
  9270. vec_subs(vector unsigned char __a, vector bool char __b) {
  9271. return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
  9272. }
  9273. static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
  9274. vector short __b) {
  9275. return __builtin_altivec_vsubshs(__a, __b);
  9276. }
  9277. static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
  9278. vector short __b) {
  9279. return __builtin_altivec_vsubshs((vector short)__a, __b);
  9280. }
  9281. static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
  9282. vector bool short __b) {
  9283. return __builtin_altivec_vsubshs(__a, (vector short)__b);
  9284. }
  9285. static __inline__ vector unsigned short __ATTRS_o_ai
  9286. vec_subs(vector unsigned short __a, vector unsigned short __b) {
  9287. return __builtin_altivec_vsubuhs(__a, __b);
  9288. }
  9289. static __inline__ vector unsigned short __ATTRS_o_ai
  9290. vec_subs(vector bool short __a, vector unsigned short __b) {
  9291. return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
  9292. }
  9293. static __inline__ vector unsigned short __ATTRS_o_ai
  9294. vec_subs(vector unsigned short __a, vector bool short __b) {
  9295. return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
  9296. }
  9297. static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
  9298. vector int __b) {
  9299. return __builtin_altivec_vsubsws(__a, __b);
  9300. }
  9301. static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
  9302. vector int __b) {
  9303. return __builtin_altivec_vsubsws((vector int)__a, __b);
  9304. }
  9305. static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
  9306. vector bool int __b) {
  9307. return __builtin_altivec_vsubsws(__a, (vector int)__b);
  9308. }
  9309. static __inline__ vector unsigned int __ATTRS_o_ai
  9310. vec_subs(vector unsigned int __a, vector unsigned int __b) {
  9311. return __builtin_altivec_vsubuws(__a, __b);
  9312. }
  9313. static __inline__ vector unsigned int __ATTRS_o_ai
  9314. vec_subs(vector bool int __a, vector unsigned int __b) {
  9315. return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
  9316. }
  9317. static __inline__ vector unsigned int __ATTRS_o_ai
  9318. vec_subs(vector unsigned int __a, vector bool int __b) {
  9319. return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
  9320. }
  9321. /* vec_vsubsbs */
  9322. static __inline__ vector signed char __ATTRS_o_ai
  9323. vec_vsubsbs(vector signed char __a, vector signed char __b) {
  9324. return __builtin_altivec_vsubsbs(__a, __b);
  9325. }
  9326. static __inline__ vector signed char __ATTRS_o_ai
  9327. vec_vsubsbs(vector bool char __a, vector signed char __b) {
  9328. return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
  9329. }
  9330. static __inline__ vector signed char __ATTRS_o_ai
  9331. vec_vsubsbs(vector signed char __a, vector bool char __b) {
  9332. return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
  9333. }
  9334. /* vec_vsububs */
  9335. static __inline__ vector unsigned char __ATTRS_o_ai
  9336. vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
  9337. return __builtin_altivec_vsububs(__a, __b);
  9338. }
  9339. static __inline__ vector unsigned char __ATTRS_o_ai
  9340. vec_vsububs(vector bool char __a, vector unsigned char __b) {
  9341. return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
  9342. }
  9343. static __inline__ vector unsigned char __ATTRS_o_ai
  9344. vec_vsububs(vector unsigned char __a, vector bool char __b) {
  9345. return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
  9346. }
  9347. /* vec_vsubshs */
  9348. static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
  9349. vector short __b) {
  9350. return __builtin_altivec_vsubshs(__a, __b);
  9351. }
  9352. static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
  9353. vector short __b) {
  9354. return __builtin_altivec_vsubshs((vector short)__a, __b);
  9355. }
  9356. static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
  9357. vector bool short __b) {
  9358. return __builtin_altivec_vsubshs(__a, (vector short)__b);
  9359. }
  9360. /* vec_vsubuhs */
  9361. static __inline__ vector unsigned short __ATTRS_o_ai
  9362. vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
  9363. return __builtin_altivec_vsubuhs(__a, __b);
  9364. }
  9365. static __inline__ vector unsigned short __ATTRS_o_ai
  9366. vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
  9367. return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
  9368. }
  9369. static __inline__ vector unsigned short __ATTRS_o_ai
  9370. vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
  9371. return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
  9372. }
  9373. /* vec_vsubsws */
  9374. static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
  9375. vector int __b) {
  9376. return __builtin_altivec_vsubsws(__a, __b);
  9377. }
  9378. static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
  9379. vector int __b) {
  9380. return __builtin_altivec_vsubsws((vector int)__a, __b);
  9381. }
  9382. static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
  9383. vector bool int __b) {
  9384. return __builtin_altivec_vsubsws(__a, (vector int)__b);
  9385. }
  9386. /* vec_vsubuws */
  9387. static __inline__ vector unsigned int __ATTRS_o_ai
  9388. vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
  9389. return __builtin_altivec_vsubuws(__a, __b);
  9390. }
  9391. static __inline__ vector unsigned int __ATTRS_o_ai
  9392. vec_vsubuws(vector bool int __a, vector unsigned int __b) {
  9393. return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
  9394. }
  9395. static __inline__ vector unsigned int __ATTRS_o_ai
  9396. vec_vsubuws(vector unsigned int __a, vector bool int __b) {
  9397. return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
  9398. }
  9399. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  9400. /* vec_vsubuqm */
  9401. static __inline__ vector signed __int128 __ATTRS_o_ai
  9402. vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
  9403. return __a - __b;
  9404. }
  9405. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  9406. vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
  9407. return __a - __b;
  9408. }
  9409. /* vec_vsubeuqm */
  9410. static __inline__ vector signed __int128 __ATTRS_o_ai
  9411. vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
  9412. vector signed __int128 __c) {
  9413. return __builtin_altivec_vsubeuqm(__a, __b, __c);
  9414. }
  9415. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  9416. vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
  9417. vector unsigned __int128 __c) {
  9418. return __builtin_altivec_vsubeuqm(__a, __b, __c);
  9419. }
  9420. static __inline__ vector signed __int128 __ATTRS_o_ai
  9421. vec_sube(vector signed __int128 __a, vector signed __int128 __b,
  9422. vector signed __int128 __c) {
  9423. return __builtin_altivec_vsubeuqm(__a, __b, __c);
  9424. }
  9425. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  9426. vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
  9427. vector unsigned __int128 __c) {
  9428. return __builtin_altivec_vsubeuqm(__a, __b, __c);
  9429. }
  9430. /* vec_vsubcuq */
  9431. static __inline__ vector signed __int128 __ATTRS_o_ai
  9432. vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
  9433. return __builtin_altivec_vsubcuq(__a, __b);
  9434. }
  9435. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  9436. vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
  9437. return __builtin_altivec_vsubcuq(__a, __b);
  9438. }
  9439. /* vec_vsubecuq */
  9440. static __inline__ vector signed __int128 __ATTRS_o_ai
  9441. vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
  9442. vector signed __int128 __c) {
  9443. return __builtin_altivec_vsubecuq(__a, __b, __c);
  9444. }
  9445. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  9446. vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
  9447. vector unsigned __int128 __c) {
  9448. return __builtin_altivec_vsubecuq(__a, __b, __c);
  9449. }
  9450. static __inline__ vector signed int __ATTRS_o_ai
  9451. vec_subec(vector signed int __a, vector signed int __b,
  9452. vector signed int __c) {
  9453. return vec_addec(__a, ~__b, __c);
  9454. }
  9455. static __inline__ vector unsigned int __ATTRS_o_ai
  9456. vec_subec(vector unsigned int __a, vector unsigned int __b,
  9457. vector unsigned int __c) {
  9458. return vec_addec(__a, ~__b, __c);
  9459. }
  9460. static __inline__ vector signed __int128 __ATTRS_o_ai
  9461. vec_subec(vector signed __int128 __a, vector signed __int128 __b,
  9462. vector signed __int128 __c) {
  9463. return __builtin_altivec_vsubecuq(__a, __b, __c);
  9464. }
  9465. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  9466. vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
  9467. vector unsigned __int128 __c) {
  9468. return __builtin_altivec_vsubecuq(__a, __b, __c);
  9469. }
  9470. #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  9471. static __inline__ vector signed int __ATTRS_o_ai
  9472. vec_sube(vector signed int __a, vector signed int __b,
  9473. vector signed int __c) {
  9474. vector signed int __mask = {1, 1, 1, 1};
  9475. vector signed int __carry = __c & __mask;
  9476. return vec_adde(__a, ~__b, __carry);
  9477. }
  9478. static __inline__ vector unsigned int __ATTRS_o_ai
  9479. vec_sube(vector unsigned int __a, vector unsigned int __b,
  9480. vector unsigned int __c) {
  9481. vector unsigned int __mask = {1, 1, 1, 1};
  9482. vector unsigned int __carry = __c & __mask;
  9483. return vec_adde(__a, ~__b, __carry);
  9484. }
  9485. /* vec_sum4s */
  9486. static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
  9487. vector int __b) {
  9488. return __builtin_altivec_vsum4sbs(__a, __b);
  9489. }
  9490. static __inline__ vector unsigned int __ATTRS_o_ai
  9491. vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
  9492. return __builtin_altivec_vsum4ubs(__a, __b);
  9493. }
  9494. static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
  9495. vector int __b) {
  9496. return __builtin_altivec_vsum4shs(__a, __b);
  9497. }
  9498. /* vec_vsum4sbs */
  9499. static __inline__ vector int __attribute__((__always_inline__))
  9500. vec_vsum4sbs(vector signed char __a, vector int __b) {
  9501. return __builtin_altivec_vsum4sbs(__a, __b);
  9502. }
  9503. /* vec_vsum4ubs */
  9504. static __inline__ vector unsigned int __attribute__((__always_inline__))
  9505. vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
  9506. return __builtin_altivec_vsum4ubs(__a, __b);
  9507. }
  9508. /* vec_vsum4shs */
  9509. static __inline__ vector int __attribute__((__always_inline__))
  9510. vec_vsum4shs(vector signed short __a, vector int __b) {
  9511. return __builtin_altivec_vsum4shs(__a, __b);
  9512. }
  9513. /* vec_sum2s */
  9514. /* The vsum2sws instruction has a big-endian bias, so that the second
  9515. input vector and the result always reference big-endian elements
  9516. 1 and 3 (little-endian element 0 and 2). For ease of porting the
  9517. programmer wants elements 1 and 3 in both cases, so for little
  9518. endian we must perform some permutes. */
  9519. static __inline__ vector signed int __attribute__((__always_inline__))
  9520. vec_sum2s(vector int __a, vector int __b) {
  9521. #ifdef __LITTLE_ENDIAN__
  9522. vector int __c = (vector signed int)vec_perm(
  9523. __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
  9524. 8, 9, 10, 11));
  9525. __c = __builtin_altivec_vsum2sws(__a, __c);
  9526. return (vector signed int)vec_perm(
  9527. __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
  9528. 8, 9, 10, 11));
  9529. #else
  9530. return __builtin_altivec_vsum2sws(__a, __b);
  9531. #endif
  9532. }
  9533. /* vec_vsum2sws */
  9534. static __inline__ vector signed int __attribute__((__always_inline__))
  9535. vec_vsum2sws(vector int __a, vector int __b) {
  9536. #ifdef __LITTLE_ENDIAN__
  9537. vector int __c = (vector signed int)vec_perm(
  9538. __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
  9539. 8, 9, 10, 11));
  9540. __c = __builtin_altivec_vsum2sws(__a, __c);
  9541. return (vector signed int)vec_perm(
  9542. __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
  9543. 8, 9, 10, 11));
  9544. #else
  9545. return __builtin_altivec_vsum2sws(__a, __b);
  9546. #endif
  9547. }
  9548. /* vec_sums */
  9549. /* The vsumsws instruction has a big-endian bias, so that the second
  9550. input vector and the result always reference big-endian element 3
  9551. (little-endian element 0). For ease of porting the programmer
  9552. wants element 3 in both cases, so for little endian we must perform
  9553. some permutes. */
  9554. static __inline__ vector signed int __attribute__((__always_inline__))
  9555. vec_sums(vector signed int __a, vector signed int __b) {
  9556. #ifdef __LITTLE_ENDIAN__
  9557. __b = (vector signed int)vec_splat(__b, 3);
  9558. __b = __builtin_altivec_vsumsws(__a, __b);
  9559. return (vector signed int)(0, 0, 0, __b[0]);
  9560. #else
  9561. return __builtin_altivec_vsumsws(__a, __b);
  9562. #endif
  9563. }
  9564. /* vec_vsumsws */
  9565. static __inline__ vector signed int __attribute__((__always_inline__))
  9566. vec_vsumsws(vector signed int __a, vector signed int __b) {
  9567. #ifdef __LITTLE_ENDIAN__
  9568. __b = (vector signed int)vec_splat(__b, 3);
  9569. __b = __builtin_altivec_vsumsws(__a, __b);
  9570. return (vector signed int)(0, 0, 0, __b[0]);
  9571. #else
  9572. return __builtin_altivec_vsumsws(__a, __b);
  9573. #endif
  9574. }
  9575. /* vec_trunc */
  9576. static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
  9577. #ifdef __VSX__
  9578. return __builtin_vsx_xvrspiz(__a);
  9579. #else
  9580. return __builtin_altivec_vrfiz(__a);
  9581. #endif
  9582. }
  9583. #ifdef __VSX__
  9584. static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
  9585. return __builtin_vsx_xvrdpiz(__a);
  9586. }
  9587. #endif
  9588. /* vec_vrfiz */
  9589. static __inline__ vector float __attribute__((__always_inline__))
  9590. vec_vrfiz(vector float __a) {
  9591. return __builtin_altivec_vrfiz(__a);
  9592. }
  9593. /* vec_unpackh */
  9594. /* The vector unpack instructions all have a big-endian bias, so for
  9595. little endian we must reverse the meanings of "high" and "low." */
  9596. static __inline__ vector short __ATTRS_o_ai
  9597. vec_unpackh(vector signed char __a) {
  9598. #ifdef __LITTLE_ENDIAN__
  9599. return __builtin_altivec_vupklsb((vector char)__a);
  9600. #else
  9601. return __builtin_altivec_vupkhsb((vector char)__a);
  9602. #endif
  9603. }
  9604. static __inline__ vector bool short __ATTRS_o_ai
  9605. vec_unpackh(vector bool char __a) {
  9606. #ifdef __LITTLE_ENDIAN__
  9607. return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
  9608. #else
  9609. return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
  9610. #endif
  9611. }
  9612. static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
  9613. #ifdef __LITTLE_ENDIAN__
  9614. return __builtin_altivec_vupklsh(__a);
  9615. #else
  9616. return __builtin_altivec_vupkhsh(__a);
  9617. #endif
  9618. }
  9619. static __inline__ vector bool int __ATTRS_o_ai
  9620. vec_unpackh(vector bool short __a) {
  9621. #ifdef __LITTLE_ENDIAN__
  9622. return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
  9623. #else
  9624. return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
  9625. #endif
  9626. }
  9627. static __inline__ vector unsigned int __ATTRS_o_ai
  9628. vec_unpackh(vector pixel __a) {
  9629. #ifdef __LITTLE_ENDIAN__
  9630. return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
  9631. #else
  9632. return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
  9633. #endif
  9634. }
  9635. #ifdef __POWER8_VECTOR__
  9636. static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
  9637. #ifdef __LITTLE_ENDIAN__
  9638. return __builtin_altivec_vupklsw(__a);
  9639. #else
  9640. return __builtin_altivec_vupkhsw(__a);
  9641. #endif
  9642. }
  9643. static __inline__ vector bool long long __ATTRS_o_ai
  9644. vec_unpackh(vector bool int __a) {
  9645. #ifdef __LITTLE_ENDIAN__
  9646. return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
  9647. #else
  9648. return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
  9649. #endif
  9650. }
  9651. static __inline__ vector double __ATTRS_o_ai
  9652. vec_unpackh(vector float __a) {
  9653. return (vector double)(__a[0], __a[1]);
  9654. }
  9655. #endif
  9656. /* vec_vupkhsb */
  9657. static __inline__ vector short __ATTRS_o_ai
  9658. vec_vupkhsb(vector signed char __a) {
  9659. #ifdef __LITTLE_ENDIAN__
  9660. return __builtin_altivec_vupklsb((vector char)__a);
  9661. #else
  9662. return __builtin_altivec_vupkhsb((vector char)__a);
  9663. #endif
  9664. }
  9665. static __inline__ vector bool short __ATTRS_o_ai
  9666. vec_vupkhsb(vector bool char __a) {
  9667. #ifdef __LITTLE_ENDIAN__
  9668. return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
  9669. #else
  9670. return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
  9671. #endif
  9672. }
  9673. /* vec_vupkhsh */
  9674. static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
  9675. #ifdef __LITTLE_ENDIAN__
  9676. return __builtin_altivec_vupklsh(__a);
  9677. #else
  9678. return __builtin_altivec_vupkhsh(__a);
  9679. #endif
  9680. }
  9681. static __inline__ vector bool int __ATTRS_o_ai
  9682. vec_vupkhsh(vector bool short __a) {
  9683. #ifdef __LITTLE_ENDIAN__
  9684. return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
  9685. #else
  9686. return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
  9687. #endif
  9688. }
  9689. static __inline__ vector unsigned int __ATTRS_o_ai
  9690. vec_vupkhsh(vector pixel __a) {
  9691. #ifdef __LITTLE_ENDIAN__
  9692. return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
  9693. #else
  9694. return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
  9695. #endif
  9696. }
  9697. /* vec_vupkhsw */
  9698. #ifdef __POWER8_VECTOR__
  9699. static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
  9700. #ifdef __LITTLE_ENDIAN__
  9701. return __builtin_altivec_vupklsw(__a);
  9702. #else
  9703. return __builtin_altivec_vupkhsw(__a);
  9704. #endif
  9705. }
  9706. static __inline__ vector bool long long __ATTRS_o_ai
  9707. vec_vupkhsw(vector bool int __a) {
  9708. #ifdef __LITTLE_ENDIAN__
  9709. return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
  9710. #else
  9711. return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
  9712. #endif
  9713. }
  9714. #endif
  9715. /* vec_unpackl */
  9716. static __inline__ vector short __ATTRS_o_ai
  9717. vec_unpackl(vector signed char __a) {
  9718. #ifdef __LITTLE_ENDIAN__
  9719. return __builtin_altivec_vupkhsb((vector char)__a);
  9720. #else
  9721. return __builtin_altivec_vupklsb((vector char)__a);
  9722. #endif
  9723. }
  9724. static __inline__ vector bool short __ATTRS_o_ai
  9725. vec_unpackl(vector bool char __a) {
  9726. #ifdef __LITTLE_ENDIAN__
  9727. return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
  9728. #else
  9729. return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
  9730. #endif
  9731. }
  9732. static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
  9733. #ifdef __LITTLE_ENDIAN__
  9734. return __builtin_altivec_vupkhsh(__a);
  9735. #else
  9736. return __builtin_altivec_vupklsh(__a);
  9737. #endif
  9738. }
  9739. static __inline__ vector bool int __ATTRS_o_ai
  9740. vec_unpackl(vector bool short __a) {
  9741. #ifdef __LITTLE_ENDIAN__
  9742. return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
  9743. #else
  9744. return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
  9745. #endif
  9746. }
  9747. static __inline__ vector unsigned int __ATTRS_o_ai
  9748. vec_unpackl(vector pixel __a) {
  9749. #ifdef __LITTLE_ENDIAN__
  9750. return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
  9751. #else
  9752. return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
  9753. #endif
  9754. }
  9755. #ifdef __POWER8_VECTOR__
  9756. static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
  9757. #ifdef __LITTLE_ENDIAN__
  9758. return __builtin_altivec_vupkhsw(__a);
  9759. #else
  9760. return __builtin_altivec_vupklsw(__a);
  9761. #endif
  9762. }
  9763. static __inline__ vector bool long long __ATTRS_o_ai
  9764. vec_unpackl(vector bool int __a) {
  9765. #ifdef __LITTLE_ENDIAN__
  9766. return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
  9767. #else
  9768. return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
  9769. #endif
  9770. }
  9771. static __inline__ vector double __ATTRS_o_ai
  9772. vec_unpackl(vector float __a) {
  9773. return (vector double)(__a[2], __a[3]);
  9774. }
  9775. #endif
  9776. /* vec_vupklsb */
  9777. static __inline__ vector short __ATTRS_o_ai
  9778. vec_vupklsb(vector signed char __a) {
  9779. #ifdef __LITTLE_ENDIAN__
  9780. return __builtin_altivec_vupkhsb((vector char)__a);
  9781. #else
  9782. return __builtin_altivec_vupklsb((vector char)__a);
  9783. #endif
  9784. }
  9785. static __inline__ vector bool short __ATTRS_o_ai
  9786. vec_vupklsb(vector bool char __a) {
  9787. #ifdef __LITTLE_ENDIAN__
  9788. return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
  9789. #else
  9790. return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
  9791. #endif
  9792. }
  9793. /* vec_vupklsh */
  9794. static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
  9795. #ifdef __LITTLE_ENDIAN__
  9796. return __builtin_altivec_vupkhsh(__a);
  9797. #else
  9798. return __builtin_altivec_vupklsh(__a);
  9799. #endif
  9800. }
  9801. static __inline__ vector bool int __ATTRS_o_ai
  9802. vec_vupklsh(vector bool short __a) {
  9803. #ifdef __LITTLE_ENDIAN__
  9804. return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
  9805. #else
  9806. return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
  9807. #endif
  9808. }
  9809. static __inline__ vector unsigned int __ATTRS_o_ai
  9810. vec_vupklsh(vector pixel __a) {
  9811. #ifdef __LITTLE_ENDIAN__
  9812. return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
  9813. #else
  9814. return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
  9815. #endif
  9816. }
  9817. /* vec_vupklsw */
  9818. #ifdef __POWER8_VECTOR__
  9819. static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
  9820. #ifdef __LITTLE_ENDIAN__
  9821. return __builtin_altivec_vupkhsw(__a);
  9822. #else
  9823. return __builtin_altivec_vupklsw(__a);
  9824. #endif
  9825. }
  9826. static __inline__ vector bool long long __ATTRS_o_ai
  9827. vec_vupklsw(vector bool int __a) {
  9828. #ifdef __LITTLE_ENDIAN__
  9829. return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
  9830. #else
  9831. return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
  9832. #endif
  9833. }
  9834. #endif
  9835. /* vec_vsx_ld */
  9836. #ifdef __VSX__
  9837. static __inline__ vector bool int __ATTRS_o_ai
  9838. vec_vsx_ld(int __a, const vector bool int *__b) {
  9839. return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
  9840. }
  9841. static __inline__ vector signed int __ATTRS_o_ai
  9842. vec_vsx_ld(int __a, const vector signed int *__b) {
  9843. return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
  9844. }
  9845. static __inline__ vector signed int __ATTRS_o_ai
  9846. vec_vsx_ld(int __a, const signed int *__b) {
  9847. return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
  9848. }
  9849. static __inline__ vector unsigned int __ATTRS_o_ai
  9850. vec_vsx_ld(int __a, const vector unsigned int *__b) {
  9851. return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
  9852. }
  9853. static __inline__ vector unsigned int __ATTRS_o_ai
  9854. vec_vsx_ld(int __a, const unsigned int *__b) {
  9855. return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
  9856. }
  9857. static __inline__ vector float __ATTRS_o_ai
  9858. vec_vsx_ld(int __a, const vector float *__b) {
  9859. return (vector float)__builtin_vsx_lxvw4x(__a, __b);
  9860. }
  9861. static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
  9862. const float *__b) {
  9863. return (vector float)__builtin_vsx_lxvw4x(__a, __b);
  9864. }
  9865. static __inline__ vector signed long long __ATTRS_o_ai
  9866. vec_vsx_ld(int __a, const vector signed long long *__b) {
  9867. return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
  9868. }
  9869. static __inline__ vector unsigned long long __ATTRS_o_ai
  9870. vec_vsx_ld(int __a, const vector unsigned long long *__b) {
  9871. return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
  9872. }
  9873. static __inline__ vector double __ATTRS_o_ai
  9874. vec_vsx_ld(int __a, const vector double *__b) {
  9875. return (vector double)__builtin_vsx_lxvd2x(__a, __b);
  9876. }
  9877. static __inline__ vector double __ATTRS_o_ai
  9878. vec_vsx_ld(int __a, const double *__b) {
  9879. return (vector double)__builtin_vsx_lxvd2x(__a, __b);
  9880. }
  9881. static __inline__ vector bool short __ATTRS_o_ai
  9882. vec_vsx_ld(int __a, const vector bool short *__b) {
  9883. return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
  9884. }
  9885. static __inline__ vector signed short __ATTRS_o_ai
  9886. vec_vsx_ld(int __a, const vector signed short *__b) {
  9887. return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
  9888. }
  9889. static __inline__ vector signed short __ATTRS_o_ai
  9890. vec_vsx_ld(int __a, const signed short *__b) {
  9891. return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
  9892. }
  9893. static __inline__ vector unsigned short __ATTRS_o_ai
  9894. vec_vsx_ld(int __a, const vector unsigned short *__b) {
  9895. return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
  9896. }
  9897. static __inline__ vector unsigned short __ATTRS_o_ai
  9898. vec_vsx_ld(int __a, const unsigned short *__b) {
  9899. return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
  9900. }
  9901. static __inline__ vector bool char __ATTRS_o_ai
  9902. vec_vsx_ld(int __a, const vector bool char *__b) {
  9903. return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
  9904. }
  9905. static __inline__ vector signed char __ATTRS_o_ai
  9906. vec_vsx_ld(int __a, const vector signed char *__b) {
  9907. return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
  9908. }
  9909. static __inline__ vector signed char __ATTRS_o_ai
  9910. vec_vsx_ld(int __a, const signed char *__b) {
  9911. return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
  9912. }
  9913. static __inline__ vector unsigned char __ATTRS_o_ai
  9914. vec_vsx_ld(int __a, const vector unsigned char *__b) {
  9915. return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
  9916. }
  9917. static __inline__ vector unsigned char __ATTRS_o_ai
  9918. vec_vsx_ld(int __a, const unsigned char *__b) {
  9919. return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
  9920. }
  9921. #endif
  9922. /* vec_vsx_st */
  9923. #ifdef __VSX__
  9924. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
  9925. vector bool int *__c) {
  9926. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9927. }
  9928. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
  9929. signed int *__c) {
  9930. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9931. }
  9932. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
  9933. unsigned int *__c) {
  9934. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9935. }
  9936. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
  9937. vector signed int *__c) {
  9938. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9939. }
  9940. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
  9941. signed int *__c) {
  9942. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9943. }
  9944. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
  9945. vector unsigned int *__c) {
  9946. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9947. }
  9948. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
  9949. unsigned int *__c) {
  9950. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9951. }
  9952. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
  9953. vector float *__c) {
  9954. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9955. }
  9956. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
  9957. float *__c) {
  9958. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9959. }
  9960. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
  9961. int __b,
  9962. vector signed long long *__c) {
  9963. __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
  9964. }
  9965. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
  9966. int __b,
  9967. vector unsigned long long *__c) {
  9968. __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
  9969. }
  9970. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
  9971. vector double *__c) {
  9972. __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
  9973. }
  9974. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
  9975. double *__c) {
  9976. __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
  9977. }
  9978. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
  9979. vector bool short *__c) {
  9980. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9981. }
  9982. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
  9983. signed short *__c) {
  9984. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9985. }
  9986. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
  9987. unsigned short *__c) {
  9988. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9989. }
  9990. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
  9991. vector signed short *__c) {
  9992. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9993. }
  9994. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
  9995. signed short *__c) {
  9996. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  9997. }
  9998. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
  9999. int __b,
  10000. vector unsigned short *__c) {
  10001. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10002. }
  10003. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
  10004. int __b, unsigned short *__c) {
  10005. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10006. }
  10007. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
  10008. vector bool char *__c) {
  10009. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10010. }
  10011. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
  10012. signed char *__c) {
  10013. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10014. }
  10015. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
  10016. unsigned char *__c) {
  10017. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10018. }
  10019. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
  10020. vector signed char *__c) {
  10021. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10022. }
  10023. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
  10024. signed char *__c) {
  10025. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10026. }
  10027. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
  10028. int __b,
  10029. vector unsigned char *__c) {
  10030. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10031. }
  10032. static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
  10033. int __b, unsigned char *__c) {
  10034. __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
  10035. }
  10036. #endif
  10037. #ifdef __VSX__
  10038. #define vec_xxpermdi __builtin_vsx_xxpermdi
  10039. #define vec_xxsldwi __builtin_vsx_xxsldwi
  10040. #endif
  10041. /* vec_xor */
  10042. #define __builtin_altivec_vxor vec_xor
  10043. static __inline__ vector signed char __ATTRS_o_ai
  10044. vec_xor(vector signed char __a, vector signed char __b) {
  10045. return __a ^ __b;
  10046. }
  10047. static __inline__ vector signed char __ATTRS_o_ai
  10048. vec_xor(vector bool char __a, vector signed char __b) {
  10049. return (vector signed char)__a ^ __b;
  10050. }
  10051. static __inline__ vector signed char __ATTRS_o_ai
  10052. vec_xor(vector signed char __a, vector bool char __b) {
  10053. return __a ^ (vector signed char)__b;
  10054. }
  10055. static __inline__ vector unsigned char __ATTRS_o_ai
  10056. vec_xor(vector unsigned char __a, vector unsigned char __b) {
  10057. return __a ^ __b;
  10058. }
  10059. static __inline__ vector unsigned char __ATTRS_o_ai
  10060. vec_xor(vector bool char __a, vector unsigned char __b) {
  10061. return (vector unsigned char)__a ^ __b;
  10062. }
  10063. static __inline__ vector unsigned char __ATTRS_o_ai
  10064. vec_xor(vector unsigned char __a, vector bool char __b) {
  10065. return __a ^ (vector unsigned char)__b;
  10066. }
  10067. static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
  10068. vector bool char __b) {
  10069. return __a ^ __b;
  10070. }
  10071. static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
  10072. vector short __b) {
  10073. return __a ^ __b;
  10074. }
  10075. static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
  10076. vector short __b) {
  10077. return (vector short)__a ^ __b;
  10078. }
  10079. static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
  10080. vector bool short __b) {
  10081. return __a ^ (vector short)__b;
  10082. }
  10083. static __inline__ vector unsigned short __ATTRS_o_ai
  10084. vec_xor(vector unsigned short __a, vector unsigned short __b) {
  10085. return __a ^ __b;
  10086. }
  10087. static __inline__ vector unsigned short __ATTRS_o_ai
  10088. vec_xor(vector bool short __a, vector unsigned short __b) {
  10089. return (vector unsigned short)__a ^ __b;
  10090. }
  10091. static __inline__ vector unsigned short __ATTRS_o_ai
  10092. vec_xor(vector unsigned short __a, vector bool short __b) {
  10093. return __a ^ (vector unsigned short)__b;
  10094. }
  10095. static __inline__ vector bool short __ATTRS_o_ai
  10096. vec_xor(vector bool short __a, vector bool short __b) {
  10097. return __a ^ __b;
  10098. }
  10099. static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
  10100. vector int __b) {
  10101. return __a ^ __b;
  10102. }
  10103. static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
  10104. vector int __b) {
  10105. return (vector int)__a ^ __b;
  10106. }
  10107. static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
  10108. vector bool int __b) {
  10109. return __a ^ (vector int)__b;
  10110. }
  10111. static __inline__ vector unsigned int __ATTRS_o_ai
  10112. vec_xor(vector unsigned int __a, vector unsigned int __b) {
  10113. return __a ^ __b;
  10114. }
  10115. static __inline__ vector unsigned int __ATTRS_o_ai
  10116. vec_xor(vector bool int __a, vector unsigned int __b) {
  10117. return (vector unsigned int)__a ^ __b;
  10118. }
  10119. static __inline__ vector unsigned int __ATTRS_o_ai
  10120. vec_xor(vector unsigned int __a, vector bool int __b) {
  10121. return __a ^ (vector unsigned int)__b;
  10122. }
  10123. static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
  10124. vector bool int __b) {
  10125. return __a ^ __b;
  10126. }
  10127. static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
  10128. vector float __b) {
  10129. vector unsigned int __res =
  10130. (vector unsigned int)__a ^ (vector unsigned int)__b;
  10131. return (vector float)__res;
  10132. }
  10133. static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
  10134. vector float __b) {
  10135. vector unsigned int __res =
  10136. (vector unsigned int)__a ^ (vector unsigned int)__b;
  10137. return (vector float)__res;
  10138. }
  10139. static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
  10140. vector bool int __b) {
  10141. vector unsigned int __res =
  10142. (vector unsigned int)__a ^ (vector unsigned int)__b;
  10143. return (vector float)__res;
  10144. }
  10145. #ifdef __VSX__
  10146. static __inline__ vector signed long long __ATTRS_o_ai
  10147. vec_xor(vector signed long long __a, vector signed long long __b) {
  10148. return __a ^ __b;
  10149. }
  10150. static __inline__ vector signed long long __ATTRS_o_ai
  10151. vec_xor(vector bool long long __a, vector signed long long __b) {
  10152. return (vector signed long long)__a ^ __b;
  10153. }
  10154. static __inline__ vector signed long long __ATTRS_o_ai
  10155. vec_xor(vector signed long long __a, vector bool long long __b) {
  10156. return __a ^ (vector signed long long)__b;
  10157. }
  10158. static __inline__ vector unsigned long long __ATTRS_o_ai
  10159. vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
  10160. return __a ^ __b;
  10161. }
  10162. static __inline__ vector unsigned long long __ATTRS_o_ai
  10163. vec_xor(vector bool long long __a, vector unsigned long long __b) {
  10164. return (vector unsigned long long)__a ^ __b;
  10165. }
  10166. static __inline__ vector unsigned long long __ATTRS_o_ai
  10167. vec_xor(vector unsigned long long __a, vector bool long long __b) {
  10168. return __a ^ (vector unsigned long long)__b;
  10169. }
  10170. static __inline__ vector bool long long __ATTRS_o_ai
  10171. vec_xor(vector bool long long __a, vector bool long long __b) {
  10172. return __a ^ __b;
  10173. }
  10174. static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
  10175. vector double __b) {
  10176. return (vector double)((vector unsigned long long)__a ^
  10177. (vector unsigned long long)__b);
  10178. }
  10179. static __inline__ vector double __ATTRS_o_ai
  10180. vec_xor(vector double __a, vector bool long long __b) {
  10181. return (vector double)((vector unsigned long long)__a ^
  10182. (vector unsigned long long)__b);
  10183. }
  10184. static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
  10185. vector double __b) {
  10186. return (vector double)((vector unsigned long long)__a ^
  10187. (vector unsigned long long)__b);
  10188. }
  10189. #endif
  10190. /* vec_vxor */
  10191. static __inline__ vector signed char __ATTRS_o_ai
  10192. vec_vxor(vector signed char __a, vector signed char __b) {
  10193. return __a ^ __b;
  10194. }
  10195. static __inline__ vector signed char __ATTRS_o_ai
  10196. vec_vxor(vector bool char __a, vector signed char __b) {
  10197. return (vector signed char)__a ^ __b;
  10198. }
  10199. static __inline__ vector signed char __ATTRS_o_ai
  10200. vec_vxor(vector signed char __a, vector bool char __b) {
  10201. return __a ^ (vector signed char)__b;
  10202. }
  10203. static __inline__ vector unsigned char __ATTRS_o_ai
  10204. vec_vxor(vector unsigned char __a, vector unsigned char __b) {
  10205. return __a ^ __b;
  10206. }
  10207. static __inline__ vector unsigned char __ATTRS_o_ai
  10208. vec_vxor(vector bool char __a, vector unsigned char __b) {
  10209. return (vector unsigned char)__a ^ __b;
  10210. }
  10211. static __inline__ vector unsigned char __ATTRS_o_ai
  10212. vec_vxor(vector unsigned char __a, vector bool char __b) {
  10213. return __a ^ (vector unsigned char)__b;
  10214. }
  10215. static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
  10216. vector bool char __b) {
  10217. return __a ^ __b;
  10218. }
  10219. static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
  10220. vector short __b) {
  10221. return __a ^ __b;
  10222. }
  10223. static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
  10224. vector short __b) {
  10225. return (vector short)__a ^ __b;
  10226. }
  10227. static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
  10228. vector bool short __b) {
  10229. return __a ^ (vector short)__b;
  10230. }
  10231. static __inline__ vector unsigned short __ATTRS_o_ai
  10232. vec_vxor(vector unsigned short __a, vector unsigned short __b) {
  10233. return __a ^ __b;
  10234. }
  10235. static __inline__ vector unsigned short __ATTRS_o_ai
  10236. vec_vxor(vector bool short __a, vector unsigned short __b) {
  10237. return (vector unsigned short)__a ^ __b;
  10238. }
  10239. static __inline__ vector unsigned short __ATTRS_o_ai
  10240. vec_vxor(vector unsigned short __a, vector bool short __b) {
  10241. return __a ^ (vector unsigned short)__b;
  10242. }
  10243. static __inline__ vector bool short __ATTRS_o_ai
  10244. vec_vxor(vector bool short __a, vector bool short __b) {
  10245. return __a ^ __b;
  10246. }
  10247. static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
  10248. vector int __b) {
  10249. return __a ^ __b;
  10250. }
  10251. static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
  10252. vector int __b) {
  10253. return (vector int)__a ^ __b;
  10254. }
  10255. static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
  10256. vector bool int __b) {
  10257. return __a ^ (vector int)__b;
  10258. }
  10259. static __inline__ vector unsigned int __ATTRS_o_ai
  10260. vec_vxor(vector unsigned int __a, vector unsigned int __b) {
  10261. return __a ^ __b;
  10262. }
  10263. static __inline__ vector unsigned int __ATTRS_o_ai
  10264. vec_vxor(vector bool int __a, vector unsigned int __b) {
  10265. return (vector unsigned int)__a ^ __b;
  10266. }
  10267. static __inline__ vector unsigned int __ATTRS_o_ai
  10268. vec_vxor(vector unsigned int __a, vector bool int __b) {
  10269. return __a ^ (vector unsigned int)__b;
  10270. }
  10271. static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
  10272. vector bool int __b) {
  10273. return __a ^ __b;
  10274. }
  10275. static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
  10276. vector float __b) {
  10277. vector unsigned int __res =
  10278. (vector unsigned int)__a ^ (vector unsigned int)__b;
  10279. return (vector float)__res;
  10280. }
  10281. static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
  10282. vector float __b) {
  10283. vector unsigned int __res =
  10284. (vector unsigned int)__a ^ (vector unsigned int)__b;
  10285. return (vector float)__res;
  10286. }
  10287. static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
  10288. vector bool int __b) {
  10289. vector unsigned int __res =
  10290. (vector unsigned int)__a ^ (vector unsigned int)__b;
  10291. return (vector float)__res;
  10292. }
  10293. #ifdef __VSX__
  10294. static __inline__ vector signed long long __ATTRS_o_ai
  10295. vec_vxor(vector signed long long __a, vector signed long long __b) {
  10296. return __a ^ __b;
  10297. }
  10298. static __inline__ vector signed long long __ATTRS_o_ai
  10299. vec_vxor(vector bool long long __a, vector signed long long __b) {
  10300. return (vector signed long long)__a ^ __b;
  10301. }
  10302. static __inline__ vector signed long long __ATTRS_o_ai
  10303. vec_vxor(vector signed long long __a, vector bool long long __b) {
  10304. return __a ^ (vector signed long long)__b;
  10305. }
  10306. static __inline__ vector unsigned long long __ATTRS_o_ai
  10307. vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
  10308. return __a ^ __b;
  10309. }
  10310. static __inline__ vector unsigned long long __ATTRS_o_ai
  10311. vec_vxor(vector bool long long __a, vector unsigned long long __b) {
  10312. return (vector unsigned long long)__a ^ __b;
  10313. }
  10314. static __inline__ vector unsigned long long __ATTRS_o_ai
  10315. vec_vxor(vector unsigned long long __a, vector bool long long __b) {
  10316. return __a ^ (vector unsigned long long)__b;
  10317. }
  10318. static __inline__ vector bool long long __ATTRS_o_ai
  10319. vec_vxor(vector bool long long __a, vector bool long long __b) {
  10320. return __a ^ __b;
  10321. }
  10322. #endif
  10323. /* ------------------------ extensions for CBEA ----------------------------- */
  10324. /* vec_extract */
  10325. static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
  10326. int __b) {
  10327. return __a[__b];
  10328. }
  10329. static __inline__ unsigned char __ATTRS_o_ai
  10330. vec_extract(vector unsigned char __a, int __b) {
  10331. return __a[__b];
  10332. }
  10333. static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
  10334. int __b) {
  10335. return __a[__b];
  10336. }
  10337. static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
  10338. int __b) {
  10339. return __a[__b];
  10340. }
  10341. static __inline__ unsigned short __ATTRS_o_ai
  10342. vec_extract(vector unsigned short __a, int __b) {
  10343. return __a[__b];
  10344. }
  10345. static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
  10346. int __b) {
  10347. return __a[__b];
  10348. }
  10349. static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
  10350. int __b) {
  10351. return __a[__b];
  10352. }
  10353. static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
  10354. int __b) {
  10355. return __a[__b];
  10356. }
  10357. static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
  10358. int __b) {
  10359. return __a[__b];
  10360. }
  10361. #ifdef __VSX__
  10362. static __inline__ signed long long __ATTRS_o_ai
  10363. vec_extract(vector signed long long __a, int __b) {
  10364. return __a[__b];
  10365. }
  10366. static __inline__ unsigned long long __ATTRS_o_ai
  10367. vec_extract(vector unsigned long long __a, int __b) {
  10368. return __a[__b];
  10369. }
  10370. static __inline__ unsigned long long __ATTRS_o_ai
  10371. vec_extract(vector bool long long __a, int __b) {
  10372. return __a[__b];
  10373. }
  10374. static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) {
  10375. return __a[__b];
  10376. }
  10377. #endif
  10378. static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) {
  10379. return __a[__b];
  10380. }
  10381. #ifdef __POWER9_VECTOR__
  10382. #define vec_insert4b __builtin_vsx_insertword
  10383. #define vec_extract4b __builtin_vsx_extractuword
  10384. /* vec_extract_exp */
  10385. static __inline__ vector unsigned int __ATTRS_o_ai
  10386. vec_extract_exp(vector float __a) {
  10387. return __builtin_vsx_xvxexpsp(__a);
  10388. }
  10389. static __inline__ vector unsigned long long __ATTRS_o_ai
  10390. vec_extract_exp(vector double __a) {
  10391. return __builtin_vsx_xvxexpdp(__a);
  10392. }
  10393. /* vec_extract_sig */
  10394. static __inline__ vector unsigned int __ATTRS_o_ai
  10395. vec_extract_sig(vector float __a) {
  10396. return __builtin_vsx_xvxsigsp(__a);
  10397. }
  10398. static __inline__ vector unsigned long long __ATTRS_o_ai
  10399. vec_extract_sig (vector double __a) {
  10400. return __builtin_vsx_xvxsigdp(__a);
  10401. }
  10402. static __inline__ vector float __ATTRS_o_ai
  10403. vec_extract_fp32_from_shorth(vector unsigned short __a) {
  10404. vector unsigned short __b =
  10405. #ifdef __LITTLE_ENDIAN__
  10406. __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
  10407. #else
  10408. __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
  10409. #endif
  10410. return __builtin_vsx_xvcvhpsp(__b);
  10411. }
  10412. static __inline__ vector float __ATTRS_o_ai
  10413. vec_extract_fp32_from_shortl(vector unsigned short __a) {
  10414. vector unsigned short __b =
  10415. #ifdef __LITTLE_ENDIAN__
  10416. __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
  10417. #else
  10418. __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
  10419. #endif
  10420. return __builtin_vsx_xvcvhpsp(__b);
  10421. }
  10422. #endif /* __POWER9_VECTOR__ */
  10423. /* vec_insert */
  10424. static __inline__ vector signed char __ATTRS_o_ai
  10425. vec_insert(signed char __a, vector signed char __b, int __c) {
  10426. __b[__c] = __a;
  10427. return __b;
  10428. }
  10429. static __inline__ vector unsigned char __ATTRS_o_ai
  10430. vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
  10431. __b[__c] = __a;
  10432. return __b;
  10433. }
  10434. static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
  10435. vector bool char __b,
  10436. int __c) {
  10437. __b[__c] = __a;
  10438. return __b;
  10439. }
  10440. static __inline__ vector signed short __ATTRS_o_ai
  10441. vec_insert(signed short __a, vector signed short __b, int __c) {
  10442. __b[__c] = __a;
  10443. return __b;
  10444. }
  10445. static __inline__ vector unsigned short __ATTRS_o_ai
  10446. vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
  10447. __b[__c] = __a;
  10448. return __b;
  10449. }
  10450. static __inline__ vector bool short __ATTRS_o_ai
  10451. vec_insert(unsigned short __a, vector bool short __b, int __c) {
  10452. __b[__c] = __a;
  10453. return __b;
  10454. }
  10455. static __inline__ vector signed int __ATTRS_o_ai
  10456. vec_insert(signed int __a, vector signed int __b, int __c) {
  10457. __b[__c] = __a;
  10458. return __b;
  10459. }
  10460. static __inline__ vector unsigned int __ATTRS_o_ai
  10461. vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
  10462. __b[__c] = __a;
  10463. return __b;
  10464. }
  10465. static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
  10466. vector bool int __b,
  10467. int __c) {
  10468. __b[__c] = __a;
  10469. return __b;
  10470. }
  10471. #ifdef __VSX__
  10472. static __inline__ vector signed long long __ATTRS_o_ai
  10473. vec_insert(signed long long __a, vector signed long long __b, int __c) {
  10474. __b[__c] = __a;
  10475. return __b;
  10476. }
  10477. static __inline__ vector unsigned long long __ATTRS_o_ai
  10478. vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
  10479. __b[__c] = __a;
  10480. return __b;
  10481. }
  10482. static __inline__ vector bool long long __ATTRS_o_ai
  10483. vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
  10484. __b[__c] = __a;
  10485. return __b;
  10486. }
  10487. static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
  10488. vector double __b,
  10489. int __c) {
  10490. __b[__c] = __a;
  10491. return __b;
  10492. }
  10493. #endif
  10494. static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
  10495. vector float __b,
  10496. int __c) {
  10497. __b[__c] = __a;
  10498. return __b;
  10499. }
  10500. /* vec_lvlx */
  10501. static __inline__ vector signed char __ATTRS_o_ai
  10502. vec_lvlx(int __a, const signed char *__b) {
  10503. return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
  10504. vec_lvsl(__a, __b));
  10505. }
  10506. static __inline__ vector signed char __ATTRS_o_ai
  10507. vec_lvlx(int __a, const vector signed char *__b) {
  10508. return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
  10509. vec_lvsl(__a, (unsigned char *)__b));
  10510. }
  10511. static __inline__ vector unsigned char __ATTRS_o_ai
  10512. vec_lvlx(int __a, const unsigned char *__b) {
  10513. return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
  10514. vec_lvsl(__a, __b));
  10515. }
  10516. static __inline__ vector unsigned char __ATTRS_o_ai
  10517. vec_lvlx(int __a, const vector unsigned char *__b) {
  10518. return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
  10519. vec_lvsl(__a, (unsigned char *)__b));
  10520. }
  10521. static __inline__ vector bool char __ATTRS_o_ai
  10522. vec_lvlx(int __a, const vector bool char *__b) {
  10523. return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
  10524. vec_lvsl(__a, (unsigned char *)__b));
  10525. }
  10526. static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
  10527. const short *__b) {
  10528. return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
  10529. }
  10530. static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
  10531. const vector short *__b) {
  10532. return vec_perm(vec_ld(__a, __b), (vector short)(0),
  10533. vec_lvsl(__a, (unsigned char *)__b));
  10534. }
  10535. static __inline__ vector unsigned short __ATTRS_o_ai
  10536. vec_lvlx(int __a, const unsigned short *__b) {
  10537. return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
  10538. vec_lvsl(__a, __b));
  10539. }
  10540. static __inline__ vector unsigned short __ATTRS_o_ai
  10541. vec_lvlx(int __a, const vector unsigned short *__b) {
  10542. return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
  10543. vec_lvsl(__a, (unsigned char *)__b));
  10544. }
  10545. static __inline__ vector bool short __ATTRS_o_ai
  10546. vec_lvlx(int __a, const vector bool short *__b) {
  10547. return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
  10548. vec_lvsl(__a, (unsigned char *)__b));
  10549. }
  10550. static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
  10551. const vector pixel *__b) {
  10552. return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
  10553. vec_lvsl(__a, (unsigned char *)__b));
  10554. }
  10555. static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
  10556. return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
  10557. }
  10558. static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
  10559. const vector int *__b) {
  10560. return vec_perm(vec_ld(__a, __b), (vector int)(0),
  10561. vec_lvsl(__a, (unsigned char *)__b));
  10562. }
  10563. static __inline__ vector unsigned int __ATTRS_o_ai
  10564. vec_lvlx(int __a, const unsigned int *__b) {
  10565. return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
  10566. vec_lvsl(__a, __b));
  10567. }
  10568. static __inline__ vector unsigned int __ATTRS_o_ai
  10569. vec_lvlx(int __a, const vector unsigned int *__b) {
  10570. return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
  10571. vec_lvsl(__a, (unsigned char *)__b));
  10572. }
  10573. static __inline__ vector bool int __ATTRS_o_ai
  10574. vec_lvlx(int __a, const vector bool int *__b) {
  10575. return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
  10576. vec_lvsl(__a, (unsigned char *)__b));
  10577. }
  10578. static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
  10579. const float *__b) {
  10580. return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
  10581. }
  10582. static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
  10583. const vector float *__b) {
  10584. return vec_perm(vec_ld(__a, __b), (vector float)(0),
  10585. vec_lvsl(__a, (unsigned char *)__b));
  10586. }
  10587. /* vec_lvlxl */
  10588. static __inline__ vector signed char __ATTRS_o_ai
  10589. vec_lvlxl(int __a, const signed char *__b) {
  10590. return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
  10591. vec_lvsl(__a, __b));
  10592. }
  10593. static __inline__ vector signed char __ATTRS_o_ai
  10594. vec_lvlxl(int __a, const vector signed char *__b) {
  10595. return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
  10596. vec_lvsl(__a, (unsigned char *)__b));
  10597. }
  10598. static __inline__ vector unsigned char __ATTRS_o_ai
  10599. vec_lvlxl(int __a, const unsigned char *__b) {
  10600. return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
  10601. vec_lvsl(__a, __b));
  10602. }
  10603. static __inline__ vector unsigned char __ATTRS_o_ai
  10604. vec_lvlxl(int __a, const vector unsigned char *__b) {
  10605. return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
  10606. vec_lvsl(__a, (unsigned char *)__b));
  10607. }
  10608. static __inline__ vector bool char __ATTRS_o_ai
  10609. vec_lvlxl(int __a, const vector bool char *__b) {
  10610. return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
  10611. vec_lvsl(__a, (unsigned char *)__b));
  10612. }
  10613. static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
  10614. const short *__b) {
  10615. return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
  10616. }
  10617. static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
  10618. const vector short *__b) {
  10619. return vec_perm(vec_ldl(__a, __b), (vector short)(0),
  10620. vec_lvsl(__a, (unsigned char *)__b));
  10621. }
  10622. static __inline__ vector unsigned short __ATTRS_o_ai
  10623. vec_lvlxl(int __a, const unsigned short *__b) {
  10624. return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
  10625. vec_lvsl(__a, __b));
  10626. }
  10627. static __inline__ vector unsigned short __ATTRS_o_ai
  10628. vec_lvlxl(int __a, const vector unsigned short *__b) {
  10629. return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
  10630. vec_lvsl(__a, (unsigned char *)__b));
  10631. }
  10632. static __inline__ vector bool short __ATTRS_o_ai
  10633. vec_lvlxl(int __a, const vector bool short *__b) {
  10634. return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
  10635. vec_lvsl(__a, (unsigned char *)__b));
  10636. }
  10637. static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
  10638. const vector pixel *__b) {
  10639. return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
  10640. vec_lvsl(__a, (unsigned char *)__b));
  10641. }
  10642. static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
  10643. return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
  10644. }
  10645. static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
  10646. const vector int *__b) {
  10647. return vec_perm(vec_ldl(__a, __b), (vector int)(0),
  10648. vec_lvsl(__a, (unsigned char *)__b));
  10649. }
  10650. static __inline__ vector unsigned int __ATTRS_o_ai
  10651. vec_lvlxl(int __a, const unsigned int *__b) {
  10652. return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
  10653. vec_lvsl(__a, __b));
  10654. }
  10655. static __inline__ vector unsigned int __ATTRS_o_ai
  10656. vec_lvlxl(int __a, const vector unsigned int *__b) {
  10657. return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
  10658. vec_lvsl(__a, (unsigned char *)__b));
  10659. }
  10660. static __inline__ vector bool int __ATTRS_o_ai
  10661. vec_lvlxl(int __a, const vector bool int *__b) {
  10662. return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
  10663. vec_lvsl(__a, (unsigned char *)__b));
  10664. }
  10665. static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
  10666. const float *__b) {
  10667. return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
  10668. }
  10669. static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
  10670. vector float *__b) {
  10671. return vec_perm(vec_ldl(__a, __b), (vector float)(0),
  10672. vec_lvsl(__a, (unsigned char *)__b));
  10673. }
  10674. /* vec_lvrx */
  10675. static __inline__ vector signed char __ATTRS_o_ai
  10676. vec_lvrx(int __a, const signed char *__b) {
  10677. return vec_perm((vector signed char)(0), vec_ld(__a, __b),
  10678. vec_lvsl(__a, __b));
  10679. }
  10680. static __inline__ vector signed char __ATTRS_o_ai
  10681. vec_lvrx(int __a, const vector signed char *__b) {
  10682. return vec_perm((vector signed char)(0), vec_ld(__a, __b),
  10683. vec_lvsl(__a, (unsigned char *)__b));
  10684. }
  10685. static __inline__ vector unsigned char __ATTRS_o_ai
  10686. vec_lvrx(int __a, const unsigned char *__b) {
  10687. return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
  10688. vec_lvsl(__a, __b));
  10689. }
  10690. static __inline__ vector unsigned char __ATTRS_o_ai
  10691. vec_lvrx(int __a, const vector unsigned char *__b) {
  10692. return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
  10693. vec_lvsl(__a, (unsigned char *)__b));
  10694. }
  10695. static __inline__ vector bool char __ATTRS_o_ai
  10696. vec_lvrx(int __a, const vector bool char *__b) {
  10697. return vec_perm((vector bool char)(0), vec_ld(__a, __b),
  10698. vec_lvsl(__a, (unsigned char *)__b));
  10699. }
  10700. static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
  10701. const short *__b) {
  10702. return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
  10703. }
  10704. static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
  10705. const vector short *__b) {
  10706. return vec_perm((vector short)(0), vec_ld(__a, __b),
  10707. vec_lvsl(__a, (unsigned char *)__b));
  10708. }
  10709. static __inline__ vector unsigned short __ATTRS_o_ai
  10710. vec_lvrx(int __a, const unsigned short *__b) {
  10711. return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
  10712. vec_lvsl(__a, __b));
  10713. }
  10714. static __inline__ vector unsigned short __ATTRS_o_ai
  10715. vec_lvrx(int __a, const vector unsigned short *__b) {
  10716. return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
  10717. vec_lvsl(__a, (unsigned char *)__b));
  10718. }
  10719. static __inline__ vector bool short __ATTRS_o_ai
  10720. vec_lvrx(int __a, const vector bool short *__b) {
  10721. return vec_perm((vector bool short)(0), vec_ld(__a, __b),
  10722. vec_lvsl(__a, (unsigned char *)__b));
  10723. }
  10724. static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
  10725. const vector pixel *__b) {
  10726. return vec_perm((vector pixel)(0), vec_ld(__a, __b),
  10727. vec_lvsl(__a, (unsigned char *)__b));
  10728. }
  10729. static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
  10730. return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
  10731. }
  10732. static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
  10733. const vector int *__b) {
  10734. return vec_perm((vector int)(0), vec_ld(__a, __b),
  10735. vec_lvsl(__a, (unsigned char *)__b));
  10736. }
  10737. static __inline__ vector unsigned int __ATTRS_o_ai
  10738. vec_lvrx(int __a, const unsigned int *__b) {
  10739. return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
  10740. vec_lvsl(__a, __b));
  10741. }
  10742. static __inline__ vector unsigned int __ATTRS_o_ai
  10743. vec_lvrx(int __a, const vector unsigned int *__b) {
  10744. return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
  10745. vec_lvsl(__a, (unsigned char *)__b));
  10746. }
  10747. static __inline__ vector bool int __ATTRS_o_ai
  10748. vec_lvrx(int __a, const vector bool int *__b) {
  10749. return vec_perm((vector bool int)(0), vec_ld(__a, __b),
  10750. vec_lvsl(__a, (unsigned char *)__b));
  10751. }
  10752. static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
  10753. const float *__b) {
  10754. return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
  10755. }
  10756. static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
  10757. const vector float *__b) {
  10758. return vec_perm((vector float)(0), vec_ld(__a, __b),
  10759. vec_lvsl(__a, (unsigned char *)__b));
  10760. }
  10761. /* vec_lvrxl */
  10762. static __inline__ vector signed char __ATTRS_o_ai
  10763. vec_lvrxl(int __a, const signed char *__b) {
  10764. return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
  10765. vec_lvsl(__a, __b));
  10766. }
  10767. static __inline__ vector signed char __ATTRS_o_ai
  10768. vec_lvrxl(int __a, const vector signed char *__b) {
  10769. return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
  10770. vec_lvsl(__a, (unsigned char *)__b));
  10771. }
  10772. static __inline__ vector unsigned char __ATTRS_o_ai
  10773. vec_lvrxl(int __a, const unsigned char *__b) {
  10774. return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
  10775. vec_lvsl(__a, __b));
  10776. }
  10777. static __inline__ vector unsigned char __ATTRS_o_ai
  10778. vec_lvrxl(int __a, const vector unsigned char *__b) {
  10779. return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
  10780. vec_lvsl(__a, (unsigned char *)__b));
  10781. }
  10782. static __inline__ vector bool char __ATTRS_o_ai
  10783. vec_lvrxl(int __a, const vector bool char *__b) {
  10784. return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
  10785. vec_lvsl(__a, (unsigned char *)__b));
  10786. }
  10787. static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
  10788. const short *__b) {
  10789. return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
  10790. }
  10791. static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
  10792. const vector short *__b) {
  10793. return vec_perm((vector short)(0), vec_ldl(__a, __b),
  10794. vec_lvsl(__a, (unsigned char *)__b));
  10795. }
  10796. static __inline__ vector unsigned short __ATTRS_o_ai
  10797. vec_lvrxl(int __a, const unsigned short *__b) {
  10798. return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
  10799. vec_lvsl(__a, __b));
  10800. }
  10801. static __inline__ vector unsigned short __ATTRS_o_ai
  10802. vec_lvrxl(int __a, const vector unsigned short *__b) {
  10803. return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
  10804. vec_lvsl(__a, (unsigned char *)__b));
  10805. }
  10806. static __inline__ vector bool short __ATTRS_o_ai
  10807. vec_lvrxl(int __a, const vector bool short *__b) {
  10808. return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
  10809. vec_lvsl(__a, (unsigned char *)__b));
  10810. }
  10811. static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
  10812. const vector pixel *__b) {
  10813. return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
  10814. vec_lvsl(__a, (unsigned char *)__b));
  10815. }
  10816. static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
  10817. return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
  10818. }
  10819. static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
  10820. const vector int *__b) {
  10821. return vec_perm((vector int)(0), vec_ldl(__a, __b),
  10822. vec_lvsl(__a, (unsigned char *)__b));
  10823. }
  10824. static __inline__ vector unsigned int __ATTRS_o_ai
  10825. vec_lvrxl(int __a, const unsigned int *__b) {
  10826. return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
  10827. vec_lvsl(__a, __b));
  10828. }
  10829. static __inline__ vector unsigned int __ATTRS_o_ai
  10830. vec_lvrxl(int __a, const vector unsigned int *__b) {
  10831. return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
  10832. vec_lvsl(__a, (unsigned char *)__b));
  10833. }
  10834. static __inline__ vector bool int __ATTRS_o_ai
  10835. vec_lvrxl(int __a, const vector bool int *__b) {
  10836. return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
  10837. vec_lvsl(__a, (unsigned char *)__b));
  10838. }
  10839. static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
  10840. const float *__b) {
  10841. return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
  10842. }
  10843. static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
  10844. const vector float *__b) {
  10845. return vec_perm((vector float)(0), vec_ldl(__a, __b),
  10846. vec_lvsl(__a, (unsigned char *)__b));
  10847. }
  10848. /* vec_stvlx */
  10849. static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
  10850. signed char *__c) {
  10851. return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10852. __c);
  10853. }
  10854. static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
  10855. vector signed char *__c) {
  10856. return vec_st(
  10857. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10858. __b, __c);
  10859. }
  10860. static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
  10861. unsigned char *__c) {
  10862. return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10863. __c);
  10864. }
  10865. static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
  10866. vector unsigned char *__c) {
  10867. return vec_st(
  10868. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10869. __b, __c);
  10870. }
  10871. static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
  10872. vector bool char *__c) {
  10873. return vec_st(
  10874. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10875. __b, __c);
  10876. }
  10877. static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
  10878. short *__c) {
  10879. return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10880. __c);
  10881. }
  10882. static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
  10883. vector short *__c) {
  10884. return vec_st(
  10885. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10886. __b, __c);
  10887. }
  10888. static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
  10889. int __b, unsigned short *__c) {
  10890. return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10891. __c);
  10892. }
  10893. static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
  10894. int __b,
  10895. vector unsigned short *__c) {
  10896. return vec_st(
  10897. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10898. __b, __c);
  10899. }
  10900. static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
  10901. vector bool short *__c) {
  10902. return vec_st(
  10903. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10904. __b, __c);
  10905. }
  10906. static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
  10907. vector pixel *__c) {
  10908. return vec_st(
  10909. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10910. __b, __c);
  10911. }
  10912. static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
  10913. int *__c) {
  10914. return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10915. __c);
  10916. }
  10917. static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
  10918. vector int *__c) {
  10919. return vec_st(
  10920. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10921. __b, __c);
  10922. }
  10923. static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
  10924. unsigned int *__c) {
  10925. return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10926. __c);
  10927. }
  10928. static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
  10929. vector unsigned int *__c) {
  10930. return vec_st(
  10931. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10932. __b, __c);
  10933. }
  10934. static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
  10935. vector bool int *__c) {
  10936. return vec_st(
  10937. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10938. __b, __c);
  10939. }
  10940. static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
  10941. vector float *__c) {
  10942. return vec_st(
  10943. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10944. __b, __c);
  10945. }
  10946. /* vec_stvlxl */
  10947. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
  10948. signed char *__c) {
  10949. return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10950. __c);
  10951. }
  10952. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
  10953. vector signed char *__c) {
  10954. return vec_stl(
  10955. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10956. __b, __c);
  10957. }
  10958. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
  10959. int __b, unsigned char *__c) {
  10960. return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10961. __c);
  10962. }
  10963. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
  10964. int __b,
  10965. vector unsigned char *__c) {
  10966. return vec_stl(
  10967. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10968. __b, __c);
  10969. }
  10970. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
  10971. vector bool char *__c) {
  10972. return vec_stl(
  10973. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10974. __b, __c);
  10975. }
  10976. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
  10977. short *__c) {
  10978. return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10979. __c);
  10980. }
  10981. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
  10982. vector short *__c) {
  10983. return vec_stl(
  10984. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10985. __b, __c);
  10986. }
  10987. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
  10988. int __b, unsigned short *__c) {
  10989. return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  10990. __c);
  10991. }
  10992. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
  10993. int __b,
  10994. vector unsigned short *__c) {
  10995. return vec_stl(
  10996. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  10997. __b, __c);
  10998. }
  10999. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
  11000. vector bool short *__c) {
  11001. return vec_stl(
  11002. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  11003. __b, __c);
  11004. }
  11005. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
  11006. vector pixel *__c) {
  11007. return vec_stl(
  11008. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  11009. __b, __c);
  11010. }
  11011. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
  11012. int *__c) {
  11013. return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  11014. __c);
  11015. }
  11016. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
  11017. vector int *__c) {
  11018. return vec_stl(
  11019. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  11020. __b, __c);
  11021. }
  11022. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
  11023. unsigned int *__c) {
  11024. return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b,
  11025. __c);
  11026. }
  11027. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
  11028. vector unsigned int *__c) {
  11029. return vec_stl(
  11030. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  11031. __b, __c);
  11032. }
  11033. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
  11034. vector bool int *__c) {
  11035. return vec_stl(
  11036. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  11037. __b, __c);
  11038. }
  11039. static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
  11040. vector float *__c) {
  11041. return vec_stl(
  11042. vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
  11043. __b, __c);
  11044. }
  11045. /* vec_stvrx */
  11046. static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
  11047. signed char *__c) {
  11048. return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11049. __c);
  11050. }
  11051. static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
  11052. vector signed char *__c) {
  11053. return vec_st(
  11054. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11055. __b, __c);
  11056. }
  11057. static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
  11058. unsigned char *__c) {
  11059. return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11060. __c);
  11061. }
  11062. static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
  11063. vector unsigned char *__c) {
  11064. return vec_st(
  11065. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11066. __b, __c);
  11067. }
  11068. static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
  11069. vector bool char *__c) {
  11070. return vec_st(
  11071. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11072. __b, __c);
  11073. }
  11074. static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
  11075. short *__c) {
  11076. return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11077. __c);
  11078. }
  11079. static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
  11080. vector short *__c) {
  11081. return vec_st(
  11082. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11083. __b, __c);
  11084. }
  11085. static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
  11086. int __b, unsigned short *__c) {
  11087. return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11088. __c);
  11089. }
  11090. static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
  11091. int __b,
  11092. vector unsigned short *__c) {
  11093. return vec_st(
  11094. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11095. __b, __c);
  11096. }
  11097. static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
  11098. vector bool short *__c) {
  11099. return vec_st(
  11100. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11101. __b, __c);
  11102. }
  11103. static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
  11104. vector pixel *__c) {
  11105. return vec_st(
  11106. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11107. __b, __c);
  11108. }
  11109. static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
  11110. int *__c) {
  11111. return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11112. __c);
  11113. }
  11114. static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
  11115. vector int *__c) {
  11116. return vec_st(
  11117. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11118. __b, __c);
  11119. }
  11120. static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
  11121. unsigned int *__c) {
  11122. return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11123. __c);
  11124. }
  11125. static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
  11126. vector unsigned int *__c) {
  11127. return vec_st(
  11128. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11129. __b, __c);
  11130. }
  11131. static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
  11132. vector bool int *__c) {
  11133. return vec_st(
  11134. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11135. __b, __c);
  11136. }
  11137. static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
  11138. vector float *__c) {
  11139. return vec_st(
  11140. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11141. __b, __c);
  11142. }
  11143. /* vec_stvrxl */
  11144. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
  11145. signed char *__c) {
  11146. return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11147. __c);
  11148. }
  11149. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
  11150. vector signed char *__c) {
  11151. return vec_stl(
  11152. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11153. __b, __c);
  11154. }
  11155. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
  11156. int __b, unsigned char *__c) {
  11157. return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11158. __c);
  11159. }
  11160. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
  11161. int __b,
  11162. vector unsigned char *__c) {
  11163. return vec_stl(
  11164. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11165. __b, __c);
  11166. }
  11167. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
  11168. vector bool char *__c) {
  11169. return vec_stl(
  11170. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11171. __b, __c);
  11172. }
  11173. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
  11174. short *__c) {
  11175. return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11176. __c);
  11177. }
  11178. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
  11179. vector short *__c) {
  11180. return vec_stl(
  11181. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11182. __b, __c);
  11183. }
  11184. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
  11185. int __b, unsigned short *__c) {
  11186. return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11187. __c);
  11188. }
  11189. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
  11190. int __b,
  11191. vector unsigned short *__c) {
  11192. return vec_stl(
  11193. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11194. __b, __c);
  11195. }
  11196. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
  11197. vector bool short *__c) {
  11198. return vec_stl(
  11199. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11200. __b, __c);
  11201. }
  11202. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
  11203. vector pixel *__c) {
  11204. return vec_stl(
  11205. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11206. __b, __c);
  11207. }
  11208. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
  11209. int *__c) {
  11210. return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11211. __c);
  11212. }
  11213. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
  11214. vector int *__c) {
  11215. return vec_stl(
  11216. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11217. __b, __c);
  11218. }
  11219. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
  11220. unsigned int *__c) {
  11221. return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b,
  11222. __c);
  11223. }
  11224. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
  11225. vector unsigned int *__c) {
  11226. return vec_stl(
  11227. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11228. __b, __c);
  11229. }
  11230. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
  11231. vector bool int *__c) {
  11232. return vec_stl(
  11233. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11234. __b, __c);
  11235. }
  11236. static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
  11237. vector float *__c) {
  11238. return vec_stl(
  11239. vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
  11240. __b, __c);
  11241. }
  11242. /* vec_promote */
  11243. static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
  11244. int __b) {
  11245. vector signed char __res = (vector signed char)(0);
  11246. __res[__b] = __a;
  11247. return __res;
  11248. }
  11249. static __inline__ vector unsigned char __ATTRS_o_ai
  11250. vec_promote(unsigned char __a, int __b) {
  11251. vector unsigned char __res = (vector unsigned char)(0);
  11252. __res[__b] = __a;
  11253. return __res;
  11254. }
  11255. static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
  11256. vector short __res = (vector short)(0);
  11257. __res[__b] = __a;
  11258. return __res;
  11259. }
  11260. static __inline__ vector unsigned short __ATTRS_o_ai
  11261. vec_promote(unsigned short __a, int __b) {
  11262. vector unsigned short __res = (vector unsigned short)(0);
  11263. __res[__b] = __a;
  11264. return __res;
  11265. }
  11266. static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
  11267. vector int __res = (vector int)(0);
  11268. __res[__b] = __a;
  11269. return __res;
  11270. }
  11271. static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
  11272. int __b) {
  11273. vector unsigned int __res = (vector unsigned int)(0);
  11274. __res[__b] = __a;
  11275. return __res;
  11276. }
  11277. static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
  11278. vector float __res = (vector float)(0);
  11279. __res[__b] = __a;
  11280. return __res;
  11281. }
  11282. /* vec_splats */
  11283. static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
  11284. return (vector signed char)(__a);
  11285. }
  11286. static __inline__ vector unsigned char __ATTRS_o_ai
  11287. vec_splats(unsigned char __a) {
  11288. return (vector unsigned char)(__a);
  11289. }
  11290. static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
  11291. return (vector short)(__a);
  11292. }
  11293. static __inline__ vector unsigned short __ATTRS_o_ai
  11294. vec_splats(unsigned short __a) {
  11295. return (vector unsigned short)(__a);
  11296. }
  11297. static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
  11298. return (vector int)(__a);
  11299. }
  11300. static __inline__ vector unsigned int __ATTRS_o_ai
  11301. vec_splats(unsigned int __a) {
  11302. return (vector unsigned int)(__a);
  11303. }
  11304. #ifdef __VSX__
  11305. static __inline__ vector signed long long __ATTRS_o_ai
  11306. vec_splats(signed long long __a) {
  11307. return (vector signed long long)(__a);
  11308. }
  11309. static __inline__ vector unsigned long long __ATTRS_o_ai
  11310. vec_splats(unsigned long long __a) {
  11311. return (vector unsigned long long)(__a);
  11312. }
  11313. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  11314. static __inline__ vector signed __int128 __ATTRS_o_ai
  11315. vec_splats(signed __int128 __a) {
  11316. return (vector signed __int128)(__a);
  11317. }
  11318. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  11319. vec_splats(unsigned __int128 __a) {
  11320. return (vector unsigned __int128)(__a);
  11321. }
  11322. #endif
  11323. static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
  11324. return (vector double)(__a);
  11325. }
  11326. #endif
  11327. static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
  11328. return (vector float)(__a);
  11329. }
  11330. /* ----------------------------- predicates --------------------------------- */
  11331. /* vec_all_eq */
  11332. static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
  11333. vector signed char __b) {
  11334. return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
  11335. (vector char)__b);
  11336. }
  11337. static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
  11338. vector bool char __b) {
  11339. return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
  11340. (vector char)__b);
  11341. }
  11342. static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
  11343. vector unsigned char __b) {
  11344. return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
  11345. (vector char)__b);
  11346. }
  11347. static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
  11348. vector bool char __b) {
  11349. return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
  11350. (vector char)__b);
  11351. }
  11352. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
  11353. vector signed char __b) {
  11354. return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
  11355. (vector char)__b);
  11356. }
  11357. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
  11358. vector unsigned char __b) {
  11359. return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
  11360. (vector char)__b);
  11361. }
  11362. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
  11363. vector bool char __b) {
  11364. return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
  11365. (vector char)__b);
  11366. }
  11367. static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
  11368. vector short __b) {
  11369. return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
  11370. }
  11371. static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
  11372. vector bool short __b) {
  11373. return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
  11374. }
  11375. static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
  11376. vector unsigned short __b) {
  11377. return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
  11378. (vector short)__b);
  11379. }
  11380. static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
  11381. vector bool short __b) {
  11382. return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
  11383. (vector short)__b);
  11384. }
  11385. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
  11386. vector short __b) {
  11387. return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
  11388. (vector short)__b);
  11389. }
  11390. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
  11391. vector unsigned short __b) {
  11392. return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
  11393. (vector short)__b);
  11394. }
  11395. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
  11396. vector bool short __b) {
  11397. return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
  11398. (vector short)__b);
  11399. }
  11400. static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
  11401. vector pixel __b) {
  11402. return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
  11403. (vector short)__b);
  11404. }
  11405. static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
  11406. return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
  11407. }
  11408. static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
  11409. vector bool int __b) {
  11410. return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
  11411. }
  11412. static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
  11413. vector unsigned int __b) {
  11414. return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
  11415. (vector int)__b);
  11416. }
  11417. static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
  11418. vector bool int __b) {
  11419. return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
  11420. (vector int)__b);
  11421. }
  11422. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
  11423. vector int __b) {
  11424. return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
  11425. (vector int)__b);
  11426. }
  11427. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
  11428. vector unsigned int __b) {
  11429. return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
  11430. (vector int)__b);
  11431. }
  11432. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
  11433. vector bool int __b) {
  11434. return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
  11435. (vector int)__b);
  11436. }
  11437. #ifdef __POWER8_VECTOR__
  11438. static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
  11439. vector signed long long __b) {
  11440. return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
  11441. }
  11442. static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
  11443. vector bool long long __b) {
  11444. return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
  11445. }
  11446. static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
  11447. vector unsigned long long __b) {
  11448. return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
  11449. (vector long long)__b);
  11450. }
  11451. static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
  11452. vector bool long long __b) {
  11453. return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
  11454. (vector long long)__b);
  11455. }
  11456. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
  11457. vector long long __b) {
  11458. return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
  11459. (vector long long)__b);
  11460. }
  11461. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
  11462. vector unsigned long long __b) {
  11463. return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
  11464. (vector long long)__b);
  11465. }
  11466. static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
  11467. vector bool long long __b) {
  11468. return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
  11469. (vector long long)__b);
  11470. }
  11471. #endif
  11472. static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
  11473. vector float __b) {
  11474. #ifdef __VSX__
  11475. return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
  11476. #else
  11477. return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
  11478. #endif
  11479. }
  11480. #ifdef __VSX__
  11481. static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
  11482. vector double __b) {
  11483. return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
  11484. }
  11485. #endif
  11486. /* vec_all_ge */
  11487. static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
  11488. vector signed char __b) {
  11489. return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
  11490. }
  11491. static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
  11492. vector bool char __b) {
  11493. return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
  11494. }
  11495. static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
  11496. vector unsigned char __b) {
  11497. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
  11498. }
  11499. static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
  11500. vector bool char __b) {
  11501. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
  11502. }
  11503. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
  11504. vector signed char __b) {
  11505. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
  11506. (vector unsigned char)__a);
  11507. }
  11508. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
  11509. vector unsigned char __b) {
  11510. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
  11511. }
  11512. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
  11513. vector bool char __b) {
  11514. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
  11515. (vector unsigned char)__a);
  11516. }
  11517. static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
  11518. vector short __b) {
  11519. return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
  11520. }
  11521. static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
  11522. vector bool short __b) {
  11523. return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
  11524. }
  11525. static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
  11526. vector unsigned short __b) {
  11527. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
  11528. }
  11529. static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
  11530. vector bool short __b) {
  11531. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
  11532. __a);
  11533. }
  11534. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
  11535. vector short __b) {
  11536. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
  11537. (vector unsigned short)__a);
  11538. }
  11539. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
  11540. vector unsigned short __b) {
  11541. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
  11542. (vector unsigned short)__a);
  11543. }
  11544. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
  11545. vector bool short __b) {
  11546. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
  11547. (vector unsigned short)__a);
  11548. }
  11549. static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
  11550. return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
  11551. }
  11552. static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
  11553. vector bool int __b) {
  11554. return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
  11555. }
  11556. static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
  11557. vector unsigned int __b) {
  11558. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
  11559. }
  11560. static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
  11561. vector bool int __b) {
  11562. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
  11563. }
  11564. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
  11565. vector int __b) {
  11566. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
  11567. (vector unsigned int)__a);
  11568. }
  11569. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
  11570. vector unsigned int __b) {
  11571. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
  11572. }
  11573. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
  11574. vector bool int __b) {
  11575. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
  11576. (vector unsigned int)__a);
  11577. }
  11578. #ifdef __POWER8_VECTOR__
  11579. static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
  11580. vector signed long long __b) {
  11581. return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
  11582. }
  11583. static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
  11584. vector bool long long __b) {
  11585. return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
  11586. __a);
  11587. }
  11588. static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
  11589. vector unsigned long long __b) {
  11590. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
  11591. }
  11592. static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
  11593. vector bool long long __b) {
  11594. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
  11595. __a);
  11596. }
  11597. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
  11598. vector signed long long __b) {
  11599. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
  11600. (vector unsigned long long)__a);
  11601. }
  11602. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
  11603. vector unsigned long long __b) {
  11604. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
  11605. (vector unsigned long long)__a);
  11606. }
  11607. static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
  11608. vector bool long long __b) {
  11609. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
  11610. (vector unsigned long long)__a);
  11611. }
  11612. #endif
  11613. static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
  11614. vector float __b) {
  11615. #ifdef __VSX__
  11616. return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
  11617. #else
  11618. return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
  11619. #endif
  11620. }
  11621. #ifdef __VSX__
  11622. static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
  11623. vector double __b) {
  11624. return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
  11625. }
  11626. #endif
  11627. /* vec_all_gt */
  11628. static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
  11629. vector signed char __b) {
  11630. return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
  11631. }
  11632. static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
  11633. vector bool char __b) {
  11634. return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
  11635. }
  11636. static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
  11637. vector unsigned char __b) {
  11638. return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
  11639. }
  11640. static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
  11641. vector bool char __b) {
  11642. return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
  11643. }
  11644. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
  11645. vector signed char __b) {
  11646. return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
  11647. (vector unsigned char)__b);
  11648. }
  11649. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
  11650. vector unsigned char __b) {
  11651. return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
  11652. }
  11653. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
  11654. vector bool char __b) {
  11655. return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
  11656. (vector unsigned char)__b);
  11657. }
  11658. static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
  11659. vector short __b) {
  11660. return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
  11661. }
  11662. static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
  11663. vector bool short __b) {
  11664. return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
  11665. }
  11666. static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
  11667. vector unsigned short __b) {
  11668. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
  11669. }
  11670. static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
  11671. vector bool short __b) {
  11672. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
  11673. (vector unsigned short)__b);
  11674. }
  11675. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
  11676. vector short __b) {
  11677. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
  11678. (vector unsigned short)__b);
  11679. }
  11680. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
  11681. vector unsigned short __b) {
  11682. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
  11683. __b);
  11684. }
  11685. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
  11686. vector bool short __b) {
  11687. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
  11688. (vector unsigned short)__b);
  11689. }
  11690. static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
  11691. return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
  11692. }
  11693. static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
  11694. vector bool int __b) {
  11695. return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
  11696. }
  11697. static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
  11698. vector unsigned int __b) {
  11699. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
  11700. }
  11701. static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
  11702. vector bool int __b) {
  11703. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
  11704. }
  11705. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
  11706. vector int __b) {
  11707. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
  11708. (vector unsigned int)__b);
  11709. }
  11710. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
  11711. vector unsigned int __b) {
  11712. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
  11713. }
  11714. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
  11715. vector bool int __b) {
  11716. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
  11717. (vector unsigned int)__b);
  11718. }
  11719. #ifdef __POWER8_VECTOR__
  11720. static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
  11721. vector signed long long __b) {
  11722. return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
  11723. }
  11724. static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
  11725. vector bool long long __b) {
  11726. return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
  11727. (vector signed long long)__b);
  11728. }
  11729. static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
  11730. vector unsigned long long __b) {
  11731. return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
  11732. }
  11733. static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
  11734. vector bool long long __b) {
  11735. return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
  11736. (vector unsigned long long)__b);
  11737. }
  11738. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
  11739. vector signed long long __b) {
  11740. return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
  11741. (vector unsigned long long)__b);
  11742. }
  11743. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
  11744. vector unsigned long long __b) {
  11745. return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
  11746. __b);
  11747. }
  11748. static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
  11749. vector bool long long __b) {
  11750. return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
  11751. (vector unsigned long long)__b);
  11752. }
  11753. #endif
  11754. static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
  11755. vector float __b) {
  11756. #ifdef __VSX__
  11757. return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
  11758. #else
  11759. return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
  11760. #endif
  11761. }
  11762. #ifdef __VSX__
  11763. static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
  11764. vector double __b) {
  11765. return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
  11766. }
  11767. #endif
  11768. /* vec_all_in */
  11769. static __inline__ int __attribute__((__always_inline__))
  11770. vec_all_in(vector float __a, vector float __b) {
  11771. return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
  11772. }
  11773. /* vec_all_le */
  11774. static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
  11775. vector signed char __b) {
  11776. return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
  11777. }
  11778. static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
  11779. vector bool char __b) {
  11780. return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
  11781. }
  11782. static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
  11783. vector unsigned char __b) {
  11784. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
  11785. }
  11786. static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
  11787. vector bool char __b) {
  11788. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
  11789. }
  11790. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
  11791. vector signed char __b) {
  11792. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
  11793. (vector unsigned char)__b);
  11794. }
  11795. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
  11796. vector unsigned char __b) {
  11797. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
  11798. }
  11799. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
  11800. vector bool char __b) {
  11801. return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
  11802. (vector unsigned char)__b);
  11803. }
  11804. static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
  11805. vector short __b) {
  11806. return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
  11807. }
  11808. static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
  11809. vector bool short __b) {
  11810. return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
  11811. }
  11812. static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
  11813. vector unsigned short __b) {
  11814. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
  11815. }
  11816. static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
  11817. vector bool short __b) {
  11818. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
  11819. (vector unsigned short)__b);
  11820. }
  11821. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
  11822. vector short __b) {
  11823. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
  11824. (vector unsigned short)__b);
  11825. }
  11826. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
  11827. vector unsigned short __b) {
  11828. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
  11829. __b);
  11830. }
  11831. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
  11832. vector bool short __b) {
  11833. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
  11834. (vector unsigned short)__b);
  11835. }
  11836. static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
  11837. return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
  11838. }
  11839. static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
  11840. vector bool int __b) {
  11841. return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
  11842. }
  11843. static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
  11844. vector unsigned int __b) {
  11845. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
  11846. }
  11847. static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
  11848. vector bool int __b) {
  11849. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
  11850. }
  11851. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
  11852. vector int __b) {
  11853. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
  11854. (vector unsigned int)__b);
  11855. }
  11856. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
  11857. vector unsigned int __b) {
  11858. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
  11859. }
  11860. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
  11861. vector bool int __b) {
  11862. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
  11863. (vector unsigned int)__b);
  11864. }
  11865. #ifdef __POWER8_VECTOR__
  11866. static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
  11867. vector signed long long __b) {
  11868. return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
  11869. }
  11870. static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
  11871. vector unsigned long long __b) {
  11872. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
  11873. }
  11874. static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
  11875. vector bool long long __b) {
  11876. return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
  11877. (vector signed long long)__b);
  11878. }
  11879. static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
  11880. vector bool long long __b) {
  11881. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
  11882. (vector unsigned long long)__b);
  11883. }
  11884. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
  11885. vector signed long long __b) {
  11886. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
  11887. (vector unsigned long long)__b);
  11888. }
  11889. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
  11890. vector unsigned long long __b) {
  11891. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
  11892. __b);
  11893. }
  11894. static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
  11895. vector bool long long __b) {
  11896. return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
  11897. (vector unsigned long long)__b);
  11898. }
  11899. #endif
  11900. static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
  11901. vector float __b) {
  11902. #ifdef __VSX__
  11903. return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
  11904. #else
  11905. return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
  11906. #endif
  11907. }
  11908. #ifdef __VSX__
  11909. static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
  11910. vector double __b) {
  11911. return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
  11912. }
  11913. #endif
  11914. /* vec_all_lt */
  11915. static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
  11916. vector signed char __b) {
  11917. return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
  11918. }
  11919. static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
  11920. vector bool char __b) {
  11921. return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
  11922. }
  11923. static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
  11924. vector unsigned char __b) {
  11925. return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
  11926. }
  11927. static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
  11928. vector bool char __b) {
  11929. return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
  11930. }
  11931. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
  11932. vector signed char __b) {
  11933. return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
  11934. (vector unsigned char)__a);
  11935. }
  11936. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
  11937. vector unsigned char __b) {
  11938. return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
  11939. }
  11940. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
  11941. vector bool char __b) {
  11942. return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
  11943. (vector unsigned char)__a);
  11944. }
  11945. static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
  11946. vector short __b) {
  11947. return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
  11948. }
  11949. static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
  11950. vector bool short __b) {
  11951. return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
  11952. }
  11953. static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
  11954. vector unsigned short __b) {
  11955. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
  11956. }
  11957. static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
  11958. vector bool short __b) {
  11959. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
  11960. __a);
  11961. }
  11962. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
  11963. vector short __b) {
  11964. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
  11965. (vector unsigned short)__a);
  11966. }
  11967. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
  11968. vector unsigned short __b) {
  11969. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
  11970. (vector unsigned short)__a);
  11971. }
  11972. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
  11973. vector bool short __b) {
  11974. return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
  11975. (vector unsigned short)__a);
  11976. }
  11977. static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
  11978. return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
  11979. }
  11980. static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
  11981. vector bool int __b) {
  11982. return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
  11983. }
  11984. static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
  11985. vector unsigned int __b) {
  11986. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
  11987. }
  11988. static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
  11989. vector bool int __b) {
  11990. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
  11991. }
  11992. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
  11993. vector int __b) {
  11994. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
  11995. (vector unsigned int)__a);
  11996. }
  11997. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
  11998. vector unsigned int __b) {
  11999. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
  12000. }
  12001. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
  12002. vector bool int __b) {
  12003. return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
  12004. (vector unsigned int)__a);
  12005. }
  12006. #ifdef __POWER8_VECTOR__
  12007. static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
  12008. vector signed long long __b) {
  12009. return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
  12010. }
  12011. static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
  12012. vector unsigned long long __b) {
  12013. return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
  12014. }
  12015. static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
  12016. vector bool long long __b) {
  12017. return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
  12018. __a);
  12019. }
  12020. static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
  12021. vector bool long long __b) {
  12022. return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
  12023. __a);
  12024. }
  12025. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
  12026. vector signed long long __b) {
  12027. return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
  12028. (vector unsigned long long)__a);
  12029. }
  12030. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
  12031. vector unsigned long long __b) {
  12032. return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
  12033. (vector unsigned long long)__a);
  12034. }
  12035. static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
  12036. vector bool long long __b) {
  12037. return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
  12038. (vector unsigned long long)__a);
  12039. }
  12040. #endif
  12041. static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
  12042. vector float __b) {
  12043. #ifdef __VSX__
  12044. return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
  12045. #else
  12046. return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
  12047. #endif
  12048. }
  12049. #ifdef __VSX__
  12050. static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
  12051. vector double __b) {
  12052. return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
  12053. }
  12054. #endif
  12055. /* vec_all_nan */
  12056. static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
  12057. #ifdef __VSX__
  12058. return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
  12059. #else
  12060. return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
  12061. #endif
  12062. }
  12063. #ifdef __VSX__
  12064. static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
  12065. return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
  12066. }
  12067. #endif
  12068. /* vec_all_ne */
  12069. static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
  12070. vector signed char __b) {
  12071. return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
  12072. (vector char)__b);
  12073. }
  12074. static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
  12075. vector bool char __b) {
  12076. return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
  12077. (vector char)__b);
  12078. }
  12079. static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
  12080. vector unsigned char __b) {
  12081. return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
  12082. (vector char)__b);
  12083. }
  12084. static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
  12085. vector bool char __b) {
  12086. return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
  12087. (vector char)__b);
  12088. }
  12089. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
  12090. vector signed char __b) {
  12091. return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
  12092. (vector char)__b);
  12093. }
  12094. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
  12095. vector unsigned char __b) {
  12096. return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
  12097. (vector char)__b);
  12098. }
  12099. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
  12100. vector bool char __b) {
  12101. return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
  12102. (vector char)__b);
  12103. }
  12104. static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
  12105. vector short __b) {
  12106. return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
  12107. }
  12108. static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
  12109. vector bool short __b) {
  12110. return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
  12111. }
  12112. static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
  12113. vector unsigned short __b) {
  12114. return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
  12115. (vector short)__b);
  12116. }
  12117. static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
  12118. vector bool short __b) {
  12119. return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
  12120. (vector short)__b);
  12121. }
  12122. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
  12123. vector short __b) {
  12124. return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
  12125. (vector short)__b);
  12126. }
  12127. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
  12128. vector unsigned short __b) {
  12129. return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
  12130. (vector short)__b);
  12131. }
  12132. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
  12133. vector bool short __b) {
  12134. return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
  12135. (vector short)__b);
  12136. }
  12137. static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
  12138. vector pixel __b) {
  12139. return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
  12140. (vector short)__b);
  12141. }
  12142. static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
  12143. return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
  12144. }
  12145. static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
  12146. vector bool int __b) {
  12147. return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
  12148. }
  12149. static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
  12150. vector unsigned int __b) {
  12151. return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
  12152. (vector int)__b);
  12153. }
  12154. static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
  12155. vector bool int __b) {
  12156. return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
  12157. (vector int)__b);
  12158. }
  12159. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
  12160. vector int __b) {
  12161. return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
  12162. (vector int)__b);
  12163. }
  12164. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
  12165. vector unsigned int __b) {
  12166. return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
  12167. (vector int)__b);
  12168. }
  12169. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
  12170. vector bool int __b) {
  12171. return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
  12172. (vector int)__b);
  12173. }
  12174. #ifdef __POWER8_VECTOR__
  12175. static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
  12176. vector signed long long __b) {
  12177. return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
  12178. }
  12179. static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
  12180. vector unsigned long long __b) {
  12181. return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
  12182. (vector long long)__b);
  12183. }
  12184. static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
  12185. vector bool long long __b) {
  12186. return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
  12187. (vector signed long long)__b);
  12188. }
  12189. static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
  12190. vector bool long long __b) {
  12191. return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
  12192. (vector signed long long)__b);
  12193. }
  12194. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
  12195. vector signed long long __b) {
  12196. return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
  12197. (vector signed long long)__b);
  12198. }
  12199. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
  12200. vector unsigned long long __b) {
  12201. return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
  12202. (vector signed long long)__b);
  12203. }
  12204. static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
  12205. vector bool long long __b) {
  12206. return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
  12207. (vector signed long long)__b);
  12208. }
  12209. #endif
  12210. static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
  12211. vector float __b) {
  12212. #ifdef __VSX__
  12213. return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
  12214. #else
  12215. return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
  12216. #endif
  12217. }
  12218. #ifdef __VSX__
  12219. static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
  12220. vector double __b) {
  12221. return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
  12222. }
  12223. #endif
  12224. /* vec_all_nge */
  12225. static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
  12226. vector float __b) {
  12227. #ifdef __VSX__
  12228. return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
  12229. #else
  12230. return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
  12231. #endif
  12232. }
  12233. #ifdef __VSX__
  12234. static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
  12235. vector double __b) {
  12236. return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
  12237. }
  12238. #endif
  12239. /* vec_all_ngt */
  12240. static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
  12241. vector float __b) {
  12242. #ifdef __VSX__
  12243. return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
  12244. #else
  12245. return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
  12246. #endif
  12247. }
  12248. #ifdef __VSX__
  12249. static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
  12250. vector double __b) {
  12251. return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
  12252. }
  12253. #endif
  12254. /* vec_all_nle */
  12255. static __inline__ int __attribute__((__always_inline__))
  12256. vec_all_nle(vector float __a, vector float __b) {
  12257. return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
  12258. }
  12259. /* vec_all_nlt */
  12260. static __inline__ int __attribute__((__always_inline__))
  12261. vec_all_nlt(vector float __a, vector float __b) {
  12262. return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
  12263. }
  12264. /* vec_all_numeric */
  12265. static __inline__ int __attribute__((__always_inline__))
  12266. vec_all_numeric(vector float __a) {
  12267. return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
  12268. }
  12269. /* vec_any_eq */
  12270. static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
  12271. vector signed char __b) {
  12272. return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
  12273. (vector char)__b);
  12274. }
  12275. static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
  12276. vector bool char __b) {
  12277. return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
  12278. (vector char)__b);
  12279. }
  12280. static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
  12281. vector unsigned char __b) {
  12282. return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
  12283. (vector char)__b);
  12284. }
  12285. static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
  12286. vector bool char __b) {
  12287. return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
  12288. (vector char)__b);
  12289. }
  12290. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
  12291. vector signed char __b) {
  12292. return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
  12293. (vector char)__b);
  12294. }
  12295. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
  12296. vector unsigned char __b) {
  12297. return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
  12298. (vector char)__b);
  12299. }
  12300. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
  12301. vector bool char __b) {
  12302. return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
  12303. (vector char)__b);
  12304. }
  12305. static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
  12306. vector short __b) {
  12307. return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
  12308. }
  12309. static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
  12310. vector bool short __b) {
  12311. return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
  12312. }
  12313. static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
  12314. vector unsigned short __b) {
  12315. return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
  12316. (vector short)__b);
  12317. }
  12318. static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
  12319. vector bool short __b) {
  12320. return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
  12321. (vector short)__b);
  12322. }
  12323. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
  12324. vector short __b) {
  12325. return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
  12326. (vector short)__b);
  12327. }
  12328. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
  12329. vector unsigned short __b) {
  12330. return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
  12331. (vector short)__b);
  12332. }
  12333. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
  12334. vector bool short __b) {
  12335. return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
  12336. (vector short)__b);
  12337. }
  12338. static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
  12339. vector pixel __b) {
  12340. return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
  12341. (vector short)__b);
  12342. }
  12343. static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
  12344. return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
  12345. }
  12346. static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
  12347. vector bool int __b) {
  12348. return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
  12349. }
  12350. static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
  12351. vector unsigned int __b) {
  12352. return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
  12353. (vector int)__b);
  12354. }
  12355. static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
  12356. vector bool int __b) {
  12357. return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
  12358. (vector int)__b);
  12359. }
  12360. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
  12361. vector int __b) {
  12362. return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
  12363. (vector int)__b);
  12364. }
  12365. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
  12366. vector unsigned int __b) {
  12367. return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
  12368. (vector int)__b);
  12369. }
  12370. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
  12371. vector bool int __b) {
  12372. return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
  12373. (vector int)__b);
  12374. }
  12375. #ifdef __POWER8_VECTOR__
  12376. static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
  12377. vector signed long long __b) {
  12378. return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
  12379. }
  12380. static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
  12381. vector unsigned long long __b) {
  12382. return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
  12383. (vector long long)__b);
  12384. }
  12385. static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
  12386. vector bool long long __b) {
  12387. return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
  12388. (vector signed long long)__b);
  12389. }
  12390. static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
  12391. vector bool long long __b) {
  12392. return __builtin_altivec_vcmpequd_p(
  12393. __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
  12394. }
  12395. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
  12396. vector signed long long __b) {
  12397. return __builtin_altivec_vcmpequd_p(
  12398. __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
  12399. }
  12400. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
  12401. vector unsigned long long __b) {
  12402. return __builtin_altivec_vcmpequd_p(
  12403. __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
  12404. }
  12405. static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
  12406. vector bool long long __b) {
  12407. return __builtin_altivec_vcmpequd_p(
  12408. __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
  12409. }
  12410. #endif
  12411. static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
  12412. vector float __b) {
  12413. #ifdef __VSX__
  12414. return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
  12415. #else
  12416. return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
  12417. #endif
  12418. }
  12419. #ifdef __VSX__
  12420. static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
  12421. vector double __b) {
  12422. return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
  12423. }
  12424. #endif
  12425. /* vec_any_ge */
  12426. static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
  12427. vector signed char __b) {
  12428. return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
  12429. }
  12430. static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
  12431. vector bool char __b) {
  12432. return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
  12433. __a);
  12434. }
  12435. static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
  12436. vector unsigned char __b) {
  12437. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
  12438. }
  12439. static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
  12440. vector bool char __b) {
  12441. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
  12442. __a);
  12443. }
  12444. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
  12445. vector signed char __b) {
  12446. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
  12447. (vector unsigned char)__a);
  12448. }
  12449. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
  12450. vector unsigned char __b) {
  12451. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
  12452. (vector unsigned char)__a);
  12453. }
  12454. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
  12455. vector bool char __b) {
  12456. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
  12457. (vector unsigned char)__a);
  12458. }
  12459. static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
  12460. vector short __b) {
  12461. return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
  12462. }
  12463. static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
  12464. vector bool short __b) {
  12465. return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
  12466. }
  12467. static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
  12468. vector unsigned short __b) {
  12469. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
  12470. }
  12471. static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
  12472. vector bool short __b) {
  12473. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
  12474. __a);
  12475. }
  12476. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
  12477. vector short __b) {
  12478. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
  12479. (vector unsigned short)__a);
  12480. }
  12481. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
  12482. vector unsigned short __b) {
  12483. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
  12484. (vector unsigned short)__a);
  12485. }
  12486. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
  12487. vector bool short __b) {
  12488. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
  12489. (vector unsigned short)__a);
  12490. }
  12491. static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
  12492. return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
  12493. }
  12494. static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
  12495. vector bool int __b) {
  12496. return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
  12497. }
  12498. static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
  12499. vector unsigned int __b) {
  12500. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
  12501. }
  12502. static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
  12503. vector bool int __b) {
  12504. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
  12505. __a);
  12506. }
  12507. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
  12508. vector int __b) {
  12509. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
  12510. (vector unsigned int)__a);
  12511. }
  12512. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
  12513. vector unsigned int __b) {
  12514. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
  12515. (vector unsigned int)__a);
  12516. }
  12517. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
  12518. vector bool int __b) {
  12519. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
  12520. (vector unsigned int)__a);
  12521. }
  12522. #ifdef __POWER8_VECTOR__
  12523. static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
  12524. vector signed long long __b) {
  12525. return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
  12526. }
  12527. static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
  12528. vector unsigned long long __b) {
  12529. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
  12530. }
  12531. static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
  12532. vector bool long long __b) {
  12533. return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
  12534. (vector signed long long)__b, __a);
  12535. }
  12536. static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
  12537. vector bool long long __b) {
  12538. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
  12539. (vector unsigned long long)__b, __a);
  12540. }
  12541. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
  12542. vector signed long long __b) {
  12543. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
  12544. (vector unsigned long long)__b,
  12545. (vector unsigned long long)__a);
  12546. }
  12547. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
  12548. vector unsigned long long __b) {
  12549. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
  12550. (vector unsigned long long)__a);
  12551. }
  12552. static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
  12553. vector bool long long __b) {
  12554. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
  12555. (vector unsigned long long)__b,
  12556. (vector unsigned long long)__a);
  12557. }
  12558. #endif
  12559. static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
  12560. vector float __b) {
  12561. #ifdef __VSX__
  12562. return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
  12563. #else
  12564. return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
  12565. #endif
  12566. }
  12567. #ifdef __VSX__
  12568. static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
  12569. vector double __b) {
  12570. return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
  12571. }
  12572. #endif
  12573. /* vec_any_gt */
  12574. static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
  12575. vector signed char __b) {
  12576. return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
  12577. }
  12578. static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
  12579. vector bool char __b) {
  12580. return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
  12581. (vector signed char)__b);
  12582. }
  12583. static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
  12584. vector unsigned char __b) {
  12585. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
  12586. }
  12587. static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
  12588. vector bool char __b) {
  12589. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
  12590. (vector unsigned char)__b);
  12591. }
  12592. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
  12593. vector signed char __b) {
  12594. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
  12595. (vector unsigned char)__b);
  12596. }
  12597. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
  12598. vector unsigned char __b) {
  12599. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
  12600. __b);
  12601. }
  12602. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
  12603. vector bool char __b) {
  12604. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
  12605. (vector unsigned char)__b);
  12606. }
  12607. static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
  12608. vector short __b) {
  12609. return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
  12610. }
  12611. static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
  12612. vector bool short __b) {
  12613. return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
  12614. }
  12615. static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
  12616. vector unsigned short __b) {
  12617. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
  12618. }
  12619. static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
  12620. vector bool short __b) {
  12621. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
  12622. (vector unsigned short)__b);
  12623. }
  12624. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
  12625. vector short __b) {
  12626. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
  12627. (vector unsigned short)__b);
  12628. }
  12629. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
  12630. vector unsigned short __b) {
  12631. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
  12632. __b);
  12633. }
  12634. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
  12635. vector bool short __b) {
  12636. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
  12637. (vector unsigned short)__b);
  12638. }
  12639. static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
  12640. return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
  12641. }
  12642. static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
  12643. vector bool int __b) {
  12644. return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
  12645. }
  12646. static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
  12647. vector unsigned int __b) {
  12648. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
  12649. }
  12650. static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
  12651. vector bool int __b) {
  12652. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
  12653. (vector unsigned int)__b);
  12654. }
  12655. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
  12656. vector int __b) {
  12657. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
  12658. (vector unsigned int)__b);
  12659. }
  12660. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
  12661. vector unsigned int __b) {
  12662. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
  12663. __b);
  12664. }
  12665. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
  12666. vector bool int __b) {
  12667. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
  12668. (vector unsigned int)__b);
  12669. }
  12670. #ifdef __POWER8_VECTOR__
  12671. static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
  12672. vector signed long long __b) {
  12673. return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
  12674. }
  12675. static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
  12676. vector unsigned long long __b) {
  12677. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
  12678. }
  12679. static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
  12680. vector bool long long __b) {
  12681. return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
  12682. (vector signed long long)__b);
  12683. }
  12684. static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
  12685. vector bool long long __b) {
  12686. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
  12687. (vector unsigned long long)__b);
  12688. }
  12689. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
  12690. vector signed long long __b) {
  12691. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
  12692. (vector unsigned long long)__a,
  12693. (vector unsigned long long)__b);
  12694. }
  12695. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
  12696. vector unsigned long long __b) {
  12697. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
  12698. (vector unsigned long long)__a, __b);
  12699. }
  12700. static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
  12701. vector bool long long __b) {
  12702. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
  12703. (vector unsigned long long)__a,
  12704. (vector unsigned long long)__b);
  12705. }
  12706. #endif
  12707. static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
  12708. vector float __b) {
  12709. #ifdef __VSX__
  12710. return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
  12711. #else
  12712. return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
  12713. #endif
  12714. }
  12715. #ifdef __VSX__
  12716. static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
  12717. vector double __b) {
  12718. return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
  12719. }
  12720. #endif
  12721. /* vec_any_le */
  12722. static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
  12723. vector signed char __b) {
  12724. return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
  12725. }
  12726. static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
  12727. vector bool char __b) {
  12728. return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
  12729. (vector signed char)__b);
  12730. }
  12731. static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
  12732. vector unsigned char __b) {
  12733. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
  12734. }
  12735. static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
  12736. vector bool char __b) {
  12737. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
  12738. (vector unsigned char)__b);
  12739. }
  12740. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
  12741. vector signed char __b) {
  12742. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
  12743. (vector unsigned char)__b);
  12744. }
  12745. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
  12746. vector unsigned char __b) {
  12747. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
  12748. __b);
  12749. }
  12750. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
  12751. vector bool char __b) {
  12752. return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
  12753. (vector unsigned char)__b);
  12754. }
  12755. static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
  12756. vector short __b) {
  12757. return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
  12758. }
  12759. static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
  12760. vector bool short __b) {
  12761. return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
  12762. }
  12763. static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
  12764. vector unsigned short __b) {
  12765. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
  12766. }
  12767. static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
  12768. vector bool short __b) {
  12769. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
  12770. (vector unsigned short)__b);
  12771. }
  12772. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
  12773. vector short __b) {
  12774. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
  12775. (vector unsigned short)__b);
  12776. }
  12777. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
  12778. vector unsigned short __b) {
  12779. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
  12780. __b);
  12781. }
  12782. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
  12783. vector bool short __b) {
  12784. return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
  12785. (vector unsigned short)__b);
  12786. }
  12787. static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
  12788. return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
  12789. }
  12790. static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
  12791. vector bool int __b) {
  12792. return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
  12793. }
  12794. static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
  12795. vector unsigned int __b) {
  12796. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
  12797. }
  12798. static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
  12799. vector bool int __b) {
  12800. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
  12801. (vector unsigned int)__b);
  12802. }
  12803. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
  12804. vector int __b) {
  12805. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
  12806. (vector unsigned int)__b);
  12807. }
  12808. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
  12809. vector unsigned int __b) {
  12810. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
  12811. __b);
  12812. }
  12813. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
  12814. vector bool int __b) {
  12815. return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
  12816. (vector unsigned int)__b);
  12817. }
  12818. #ifdef __POWER8_VECTOR__
  12819. static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
  12820. vector signed long long __b) {
  12821. return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
  12822. }
  12823. static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
  12824. vector unsigned long long __b) {
  12825. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
  12826. }
  12827. static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
  12828. vector bool long long __b) {
  12829. return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
  12830. (vector signed long long)__b);
  12831. }
  12832. static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
  12833. vector bool long long __b) {
  12834. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
  12835. (vector unsigned long long)__b);
  12836. }
  12837. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
  12838. vector signed long long __b) {
  12839. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
  12840. (vector unsigned long long)__a,
  12841. (vector unsigned long long)__b);
  12842. }
  12843. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
  12844. vector unsigned long long __b) {
  12845. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
  12846. (vector unsigned long long)__a, __b);
  12847. }
  12848. static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
  12849. vector bool long long __b) {
  12850. return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
  12851. (vector unsigned long long)__a,
  12852. (vector unsigned long long)__b);
  12853. }
  12854. #endif
  12855. static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
  12856. vector float __b) {
  12857. #ifdef __VSX__
  12858. return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
  12859. #else
  12860. return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
  12861. #endif
  12862. }
  12863. #ifdef __VSX__
  12864. static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
  12865. vector double __b) {
  12866. return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
  12867. }
  12868. #endif
  12869. /* vec_any_lt */
  12870. static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
  12871. vector signed char __b) {
  12872. return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
  12873. }
  12874. static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
  12875. vector bool char __b) {
  12876. return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
  12877. __a);
  12878. }
  12879. static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
  12880. vector unsigned char __b) {
  12881. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
  12882. }
  12883. static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
  12884. vector bool char __b) {
  12885. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
  12886. __a);
  12887. }
  12888. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
  12889. vector signed char __b) {
  12890. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
  12891. (vector unsigned char)__a);
  12892. }
  12893. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
  12894. vector unsigned char __b) {
  12895. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
  12896. (vector unsigned char)__a);
  12897. }
  12898. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
  12899. vector bool char __b) {
  12900. return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
  12901. (vector unsigned char)__a);
  12902. }
  12903. static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
  12904. vector short __b) {
  12905. return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
  12906. }
  12907. static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
  12908. vector bool short __b) {
  12909. return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
  12910. }
  12911. static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
  12912. vector unsigned short __b) {
  12913. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
  12914. }
  12915. static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
  12916. vector bool short __b) {
  12917. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
  12918. __a);
  12919. }
  12920. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
  12921. vector short __b) {
  12922. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
  12923. (vector unsigned short)__a);
  12924. }
  12925. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
  12926. vector unsigned short __b) {
  12927. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
  12928. (vector unsigned short)__a);
  12929. }
  12930. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
  12931. vector bool short __b) {
  12932. return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
  12933. (vector unsigned short)__a);
  12934. }
  12935. static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
  12936. return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
  12937. }
  12938. static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
  12939. vector bool int __b) {
  12940. return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
  12941. }
  12942. static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
  12943. vector unsigned int __b) {
  12944. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
  12945. }
  12946. static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
  12947. vector bool int __b) {
  12948. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
  12949. __a);
  12950. }
  12951. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
  12952. vector int __b) {
  12953. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
  12954. (vector unsigned int)__a);
  12955. }
  12956. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
  12957. vector unsigned int __b) {
  12958. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
  12959. (vector unsigned int)__a);
  12960. }
  12961. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
  12962. vector bool int __b) {
  12963. return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
  12964. (vector unsigned int)__a);
  12965. }
  12966. #ifdef __POWER8_VECTOR__
  12967. static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
  12968. vector signed long long __b) {
  12969. return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
  12970. }
  12971. static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
  12972. vector unsigned long long __b) {
  12973. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
  12974. }
  12975. static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
  12976. vector bool long long __b) {
  12977. return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
  12978. (vector signed long long)__b, __a);
  12979. }
  12980. static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
  12981. vector bool long long __b) {
  12982. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
  12983. (vector unsigned long long)__b, __a);
  12984. }
  12985. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
  12986. vector signed long long __b) {
  12987. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
  12988. (vector unsigned long long)__b,
  12989. (vector unsigned long long)__a);
  12990. }
  12991. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
  12992. vector unsigned long long __b) {
  12993. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
  12994. (vector unsigned long long)__a);
  12995. }
  12996. static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
  12997. vector bool long long __b) {
  12998. return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
  12999. (vector unsigned long long)__b,
  13000. (vector unsigned long long)__a);
  13001. }
  13002. #endif
  13003. static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
  13004. vector float __b) {
  13005. #ifdef __VSX__
  13006. return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
  13007. #else
  13008. return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
  13009. #endif
  13010. }
  13011. #ifdef __VSX__
  13012. static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
  13013. vector double __b) {
  13014. return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
  13015. }
  13016. #endif
  13017. /* vec_any_nan */
  13018. static __inline__ int __attribute__((__always_inline__))
  13019. vec_any_nan(vector float __a) {
  13020. return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
  13021. }
  13022. /* vec_any_ne */
  13023. static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
  13024. vector signed char __b) {
  13025. return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
  13026. (vector char)__b);
  13027. }
  13028. static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
  13029. vector bool char __b) {
  13030. return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
  13031. (vector char)__b);
  13032. }
  13033. static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
  13034. vector unsigned char __b) {
  13035. return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
  13036. (vector char)__b);
  13037. }
  13038. static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
  13039. vector bool char __b) {
  13040. return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
  13041. (vector char)__b);
  13042. }
  13043. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
  13044. vector signed char __b) {
  13045. return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
  13046. (vector char)__b);
  13047. }
  13048. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
  13049. vector unsigned char __b) {
  13050. return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
  13051. (vector char)__b);
  13052. }
  13053. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
  13054. vector bool char __b) {
  13055. return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
  13056. (vector char)__b);
  13057. }
  13058. static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
  13059. vector short __b) {
  13060. return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
  13061. }
  13062. static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
  13063. vector bool short __b) {
  13064. return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
  13065. }
  13066. static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
  13067. vector unsigned short __b) {
  13068. return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
  13069. (vector short)__b);
  13070. }
  13071. static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
  13072. vector bool short __b) {
  13073. return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
  13074. (vector short)__b);
  13075. }
  13076. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
  13077. vector short __b) {
  13078. return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
  13079. (vector short)__b);
  13080. }
  13081. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
  13082. vector unsigned short __b) {
  13083. return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
  13084. (vector short)__b);
  13085. }
  13086. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
  13087. vector bool short __b) {
  13088. return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
  13089. (vector short)__b);
  13090. }
  13091. static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
  13092. vector pixel __b) {
  13093. return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
  13094. (vector short)__b);
  13095. }
  13096. static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
  13097. return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
  13098. }
  13099. static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
  13100. vector bool int __b) {
  13101. return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
  13102. }
  13103. static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
  13104. vector unsigned int __b) {
  13105. return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
  13106. (vector int)__b);
  13107. }
  13108. static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
  13109. vector bool int __b) {
  13110. return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
  13111. (vector int)__b);
  13112. }
  13113. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
  13114. vector int __b) {
  13115. return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
  13116. (vector int)__b);
  13117. }
  13118. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
  13119. vector unsigned int __b) {
  13120. return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
  13121. (vector int)__b);
  13122. }
  13123. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
  13124. vector bool int __b) {
  13125. return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
  13126. (vector int)__b);
  13127. }
  13128. #ifdef __POWER8_VECTOR__
  13129. static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
  13130. vector signed long long __b) {
  13131. return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
  13132. }
  13133. static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
  13134. vector unsigned long long __b) {
  13135. return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
  13136. (vector long long)__b);
  13137. }
  13138. static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
  13139. vector bool long long __b) {
  13140. return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
  13141. (vector signed long long)__b);
  13142. }
  13143. static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
  13144. vector bool long long __b) {
  13145. return __builtin_altivec_vcmpequd_p(
  13146. __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
  13147. }
  13148. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
  13149. vector signed long long __b) {
  13150. return __builtin_altivec_vcmpequd_p(
  13151. __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
  13152. }
  13153. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
  13154. vector unsigned long long __b) {
  13155. return __builtin_altivec_vcmpequd_p(
  13156. __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
  13157. }
  13158. static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
  13159. vector bool long long __b) {
  13160. return __builtin_altivec_vcmpequd_p(
  13161. __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b);
  13162. }
  13163. #endif
  13164. static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
  13165. vector float __b) {
  13166. #ifdef __VSX__
  13167. return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
  13168. #else
  13169. return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
  13170. #endif
  13171. }
  13172. #ifdef __VSX__
  13173. static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
  13174. vector double __b) {
  13175. return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
  13176. }
  13177. #endif
  13178. /* vec_any_nge */
  13179. static __inline__ int __attribute__((__always_inline__))
  13180. vec_any_nge(vector float __a, vector float __b) {
  13181. return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
  13182. }
  13183. /* vec_any_ngt */
  13184. static __inline__ int __attribute__((__always_inline__))
  13185. vec_any_ngt(vector float __a, vector float __b) {
  13186. return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
  13187. }
  13188. /* vec_any_nle */
  13189. static __inline__ int __attribute__((__always_inline__))
  13190. vec_any_nle(vector float __a, vector float __b) {
  13191. return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
  13192. }
  13193. /* vec_any_nlt */
  13194. static __inline__ int __attribute__((__always_inline__))
  13195. vec_any_nlt(vector float __a, vector float __b) {
  13196. return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
  13197. }
  13198. /* vec_any_numeric */
  13199. static __inline__ int __attribute__((__always_inline__))
  13200. vec_any_numeric(vector float __a) {
  13201. return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
  13202. }
  13203. /* vec_any_out */
  13204. static __inline__ int __attribute__((__always_inline__))
  13205. vec_any_out(vector float __a, vector float __b) {
  13206. return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
  13207. }
  13208. /* Power 8 Crypto functions
  13209. Note: We diverge from the current GCC implementation with regard
  13210. to cryptography and related functions as follows:
  13211. - Only the SHA and AES instructions and builtins are disabled by -mno-crypto
  13212. - The remaining ones are only available on Power8 and up so
  13213. require -mpower8-vector
  13214. The justification for this is that export requirements require that
  13215. Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
  13216. support). As a result, we need to be able to turn off support for those.
  13217. The remaining ones (currently controlled by -mcrypto for GCC) still
  13218. need to be provided on compliant hardware even if Vector.Crypto is not
  13219. provided.
  13220. */
  13221. #ifdef __CRYPTO__
  13222. #define vec_sbox_be __builtin_altivec_crypto_vsbox
  13223. #define vec_cipher_be __builtin_altivec_crypto_vcipher
  13224. #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
  13225. #define vec_ncipher_be __builtin_altivec_crypto_vncipher
  13226. #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
  13227. static __inline__ vector unsigned long long __attribute__((__always_inline__))
  13228. __builtin_crypto_vsbox(vector unsigned long long __a) {
  13229. return __builtin_altivec_crypto_vsbox(__a);
  13230. }
  13231. static __inline__ vector unsigned long long __attribute__((__always_inline__))
  13232. __builtin_crypto_vcipher(vector unsigned long long __a,
  13233. vector unsigned long long __b) {
  13234. return __builtin_altivec_crypto_vcipher(__a, __b);
  13235. }
  13236. static __inline__ vector unsigned long long __attribute__((__always_inline__))
  13237. __builtin_crypto_vcipherlast(vector unsigned long long __a,
  13238. vector unsigned long long __b) {
  13239. return __builtin_altivec_crypto_vcipherlast(__a, __b);
  13240. }
  13241. static __inline__ vector unsigned long long __attribute__((__always_inline__))
  13242. __builtin_crypto_vncipher(vector unsigned long long __a,
  13243. vector unsigned long long __b) {
  13244. return __builtin_altivec_crypto_vncipher(__a, __b);
  13245. }
  13246. static __inline__ vector unsigned long long __attribute__((__always_inline__))
  13247. __builtin_crypto_vncipherlast(vector unsigned long long __a,
  13248. vector unsigned long long __b) {
  13249. return __builtin_altivec_crypto_vncipherlast(__a, __b);
  13250. }
  13251. #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
  13252. #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
  13253. #define vec_shasigma_be(X, Y, Z) \
  13254. _Generic((X), vector unsigned int \
  13255. : __builtin_crypto_vshasigmaw, vector unsigned long long \
  13256. : __builtin_crypto_vshasigmad)((X), (Y), (Z))
  13257. #endif
  13258. #ifdef __POWER8_VECTOR__
  13259. static __inline__ vector bool char __ATTRS_o_ai
  13260. vec_permxor(vector bool char __a, vector bool char __b,
  13261. vector bool char __c) {
  13262. return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
  13263. }
  13264. static __inline__ vector signed char __ATTRS_o_ai
  13265. vec_permxor(vector signed char __a, vector signed char __b,
  13266. vector signed char __c) {
  13267. return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
  13268. }
  13269. static __inline__ vector unsigned char __ATTRS_o_ai
  13270. vec_permxor(vector unsigned char __a, vector unsigned char __b,
  13271. vector unsigned char __c) {
  13272. return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
  13273. }
  13274. static __inline__ vector unsigned char __ATTRS_o_ai
  13275. __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
  13276. vector unsigned char __c) {
  13277. return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
  13278. }
  13279. static __inline__ vector unsigned short __ATTRS_o_ai
  13280. __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
  13281. vector unsigned short __c) {
  13282. return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
  13283. (vector unsigned char)__a, (vector unsigned char)__b,
  13284. (vector unsigned char)__c);
  13285. }
  13286. static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
  13287. vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
  13288. return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
  13289. (vector unsigned char)__a, (vector unsigned char)__b,
  13290. (vector unsigned char)__c);
  13291. }
  13292. static __inline__ vector unsigned long long __ATTRS_o_ai
  13293. __builtin_crypto_vpermxor(vector unsigned long long __a,
  13294. vector unsigned long long __b,
  13295. vector unsigned long long __c) {
  13296. return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
  13297. (vector unsigned char)__a, (vector unsigned char)__b,
  13298. (vector unsigned char)__c);
  13299. }
  13300. static __inline__ vector unsigned char __ATTRS_o_ai
  13301. __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
  13302. return __builtin_altivec_crypto_vpmsumb(__a, __b);
  13303. }
  13304. static __inline__ vector unsigned short __ATTRS_o_ai
  13305. __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
  13306. return __builtin_altivec_crypto_vpmsumh(__a, __b);
  13307. }
  13308. static __inline__ vector unsigned int __ATTRS_o_ai
  13309. __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
  13310. return __builtin_altivec_crypto_vpmsumw(__a, __b);
  13311. }
  13312. static __inline__ vector unsigned long long __ATTRS_o_ai
  13313. __builtin_crypto_vpmsumb(vector unsigned long long __a,
  13314. vector unsigned long long __b) {
  13315. return __builtin_altivec_crypto_vpmsumd(__a, __b);
  13316. }
  13317. static __inline__ vector signed char __ATTRS_o_ai
  13318. vec_vgbbd(vector signed char __a) {
  13319. return __builtin_altivec_vgbbd((vector unsigned char)__a);
  13320. }
  13321. #define vec_pmsum_be __builtin_crypto_vpmsumb
  13322. #define vec_gb __builtin_altivec_vgbbd
  13323. static __inline__ vector unsigned char __ATTRS_o_ai
  13324. vec_vgbbd(vector unsigned char __a) {
  13325. return __builtin_altivec_vgbbd(__a);
  13326. }
  13327. static __inline__ vector long long __ATTRS_o_ai
  13328. vec_vbpermq(vector signed char __a, vector signed char __b) {
  13329. return __builtin_altivec_vbpermq((vector unsigned char)__a,
  13330. (vector unsigned char)__b);
  13331. }
  13332. static __inline__ vector long long __ATTRS_o_ai
  13333. vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
  13334. return __builtin_altivec_vbpermq(__a, __b);
  13335. }
  13336. #ifdef __powerpc64__
  13337. static __inline__ vector unsigned long long __attribute__((__always_inline__))
  13338. vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
  13339. return __builtin_altivec_vbpermq((vector unsigned char)__a,
  13340. (vector unsigned char)__b);
  13341. }
  13342. #endif
  13343. #endif
  13344. /* vec_reve */
  13345. static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
  13346. return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
  13347. 5, 4, 3, 2, 1, 0);
  13348. }
  13349. static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
  13350. return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
  13351. 5, 4, 3, 2, 1, 0);
  13352. }
  13353. static inline __ATTRS_o_ai vector unsigned char
  13354. vec_reve(vector unsigned char __a) {
  13355. return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
  13356. 5, 4, 3, 2, 1, 0);
  13357. }
  13358. static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
  13359. return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
  13360. }
  13361. static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
  13362. return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
  13363. }
  13364. static inline __ATTRS_o_ai vector unsigned int
  13365. vec_reve(vector unsigned int __a) {
  13366. return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
  13367. }
  13368. static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
  13369. return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
  13370. }
  13371. static inline __ATTRS_o_ai vector signed short
  13372. vec_reve(vector signed short __a) {
  13373. return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
  13374. }
  13375. static inline __ATTRS_o_ai vector unsigned short
  13376. vec_reve(vector unsigned short __a) {
  13377. return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
  13378. }
  13379. static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
  13380. return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
  13381. }
  13382. #ifdef __VSX__
  13383. static inline __ATTRS_o_ai vector bool long long
  13384. vec_reve(vector bool long long __a) {
  13385. return __builtin_shufflevector(__a, __a, 1, 0);
  13386. }
  13387. static inline __ATTRS_o_ai vector signed long long
  13388. vec_reve(vector signed long long __a) {
  13389. return __builtin_shufflevector(__a, __a, 1, 0);
  13390. }
  13391. static inline __ATTRS_o_ai vector unsigned long long
  13392. vec_reve(vector unsigned long long __a) {
  13393. return __builtin_shufflevector(__a, __a, 1, 0);
  13394. }
  13395. static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
  13396. return __builtin_shufflevector(__a, __a, 1, 0);
  13397. }
  13398. #endif
  13399. /* vec_revb */
  13400. static __inline__ vector bool char __ATTRS_o_ai
  13401. vec_revb(vector bool char __a) {
  13402. return __a;
  13403. }
  13404. static __inline__ vector signed char __ATTRS_o_ai
  13405. vec_revb(vector signed char __a) {
  13406. return __a;
  13407. }
  13408. static __inline__ vector unsigned char __ATTRS_o_ai
  13409. vec_revb(vector unsigned char __a) {
  13410. return __a;
  13411. }
  13412. static __inline__ vector bool short __ATTRS_o_ai
  13413. vec_revb(vector bool short __a) {
  13414. vector unsigned char __indices =
  13415. { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
  13416. return vec_perm(__a, __a, __indices);
  13417. }
  13418. static __inline__ vector signed short __ATTRS_o_ai
  13419. vec_revb(vector signed short __a) {
  13420. vector unsigned char __indices =
  13421. { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
  13422. return vec_perm(__a, __a, __indices);
  13423. }
  13424. static __inline__ vector unsigned short __ATTRS_o_ai
  13425. vec_revb(vector unsigned short __a) {
  13426. vector unsigned char __indices =
  13427. { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
  13428. return vec_perm(__a, __a, __indices);
  13429. }
  13430. static __inline__ vector bool int __ATTRS_o_ai
  13431. vec_revb(vector bool int __a) {
  13432. vector unsigned char __indices =
  13433. { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
  13434. return vec_perm(__a, __a, __indices);
  13435. }
  13436. static __inline__ vector signed int __ATTRS_o_ai
  13437. vec_revb(vector signed int __a) {
  13438. vector unsigned char __indices =
  13439. { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
  13440. return vec_perm(__a, __a, __indices);
  13441. }
  13442. static __inline__ vector unsigned int __ATTRS_o_ai
  13443. vec_revb(vector unsigned int __a) {
  13444. vector unsigned char __indices =
  13445. { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
  13446. return vec_perm(__a, __a, __indices);
  13447. }
  13448. static __inline__ vector float __ATTRS_o_ai
  13449. vec_revb(vector float __a) {
  13450. vector unsigned char __indices =
  13451. { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
  13452. return vec_perm(__a, __a, __indices);
  13453. }
  13454. #ifdef __VSX__
  13455. static __inline__ vector bool long long __ATTRS_o_ai
  13456. vec_revb(vector bool long long __a) {
  13457. vector unsigned char __indices =
  13458. { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
  13459. return vec_perm(__a, __a, __indices);
  13460. }
  13461. static __inline__ vector signed long long __ATTRS_o_ai
  13462. vec_revb(vector signed long long __a) {
  13463. vector unsigned char __indices =
  13464. { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
  13465. return vec_perm(__a, __a, __indices);
  13466. }
  13467. static __inline__ vector unsigned long long __ATTRS_o_ai
  13468. vec_revb(vector unsigned long long __a) {
  13469. vector unsigned char __indices =
  13470. { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
  13471. return vec_perm(__a, __a, __indices);
  13472. }
  13473. static __inline__ vector double __ATTRS_o_ai
  13474. vec_revb(vector double __a) {
  13475. vector unsigned char __indices =
  13476. { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
  13477. return vec_perm(__a, __a, __indices);
  13478. }
  13479. #endif /* End __VSX__ */
  13480. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  13481. static __inline__ vector signed __int128 __ATTRS_o_ai
  13482. vec_revb(vector signed __int128 __a) {
  13483. vector unsigned char __indices =
  13484. { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
  13485. return (vector signed __int128)vec_perm((vector signed int)__a,
  13486. (vector signed int)__a,
  13487. __indices);
  13488. }
  13489. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  13490. vec_revb(vector unsigned __int128 __a) {
  13491. vector unsigned char __indices =
  13492. { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
  13493. return (vector unsigned __int128)vec_perm((vector signed int)__a,
  13494. (vector signed int)__a,
  13495. __indices);
  13496. }
  13497. #endif /* END __POWER8_VECTOR__ && __powerpc64__ */
  13498. /* vec_xl */
  13499. static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset,
  13500. signed char *__ptr) {
  13501. return *(vector signed char *)(__ptr + __offset);
  13502. }
  13503. static inline __ATTRS_o_ai vector unsigned char
  13504. vec_xl(signed long long __offset, unsigned char *__ptr) {
  13505. return *(vector unsigned char *)(__ptr + __offset);
  13506. }
  13507. static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset,
  13508. signed short *__ptr) {
  13509. return *(vector signed short *)(__ptr + __offset);
  13510. }
  13511. static inline __ATTRS_o_ai vector unsigned short
  13512. vec_xl(signed long long __offset, unsigned short *__ptr) {
  13513. return *(vector unsigned short *)(__ptr + __offset);
  13514. }
  13515. static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset,
  13516. signed int *__ptr) {
  13517. return *(vector signed int *)(__ptr + __offset);
  13518. }
  13519. static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset,
  13520. unsigned int *__ptr) {
  13521. return *(vector unsigned int *)(__ptr + __offset);
  13522. }
  13523. static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset,
  13524. float *__ptr) {
  13525. return *(vector float *)(__ptr + __offset);
  13526. }
  13527. #ifdef __VSX__
  13528. static inline __ATTRS_o_ai vector signed long long
  13529. vec_xl(signed long long __offset, signed long long *__ptr) {
  13530. return *(vector signed long long *)(__ptr + __offset);
  13531. }
  13532. static inline __ATTRS_o_ai vector unsigned long long
  13533. vec_xl(signed long long __offset, unsigned long long *__ptr) {
  13534. return *(vector unsigned long long *)(__ptr + __offset);
  13535. }
  13536. static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset,
  13537. double *__ptr) {
  13538. return *(vector double *)(__ptr + __offset);
  13539. }
  13540. #endif
  13541. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  13542. static inline __ATTRS_o_ai vector signed __int128
  13543. vec_xl(signed long long __offset, signed __int128 *__ptr) {
  13544. return *(vector signed __int128 *)(__ptr + __offset);
  13545. }
  13546. static inline __ATTRS_o_ai vector unsigned __int128
  13547. vec_xl(signed long long __offset, unsigned __int128 *__ptr) {
  13548. return *(vector unsigned __int128 *)(__ptr + __offset);
  13549. }
  13550. #endif
  13551. /* vec_xl_be */
  13552. #ifdef __LITTLE_ENDIAN__
  13553. static __inline__ vector signed char __ATTRS_o_ai
  13554. vec_xl_be(signed long long __offset, signed char *__ptr) {
  13555. vector signed char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
  13556. return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
  13557. 13, 12, 11, 10, 9, 8);
  13558. }
  13559. static __inline__ vector unsigned char __ATTRS_o_ai
  13560. vec_xl_be(signed long long __offset, unsigned char *__ptr) {
  13561. vector unsigned char __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
  13562. return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
  13563. 13, 12, 11, 10, 9, 8);
  13564. }
  13565. static __inline__ vector signed short __ATTRS_o_ai
  13566. vec_xl_be(signed long long __offset, signed short *__ptr) {
  13567. vector signed short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
  13568. return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
  13569. }
  13570. static __inline__ vector unsigned short __ATTRS_o_ai
  13571. vec_xl_be(signed long long __offset, unsigned short *__ptr) {
  13572. vector unsigned short __vec = __builtin_vsx_lxvd2x_be(__offset, __ptr);
  13573. return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
  13574. }
  13575. static __inline__ vector signed int __ATTRS_o_ai
  13576. vec_xl_be(signed long long __offset, signed int *__ptr) {
  13577. return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
  13578. }
  13579. static __inline__ vector unsigned int __ATTRS_o_ai
  13580. vec_xl_be(signed long long __offset, unsigned int *__ptr) {
  13581. return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
  13582. }
  13583. static __inline__ vector float __ATTRS_o_ai
  13584. vec_xl_be(signed long long __offset, float *__ptr) {
  13585. return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
  13586. }
  13587. #ifdef __VSX__
  13588. static __inline__ vector signed long long __ATTRS_o_ai
  13589. vec_xl_be(signed long long __offset, signed long long *__ptr) {
  13590. return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
  13591. }
  13592. static __inline__ vector unsigned long long __ATTRS_o_ai
  13593. vec_xl_be(signed long long __offset, unsigned long long *__ptr) {
  13594. return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
  13595. }
  13596. static __inline__ vector double __ATTRS_o_ai
  13597. vec_xl_be(signed long long __offset, double *__ptr) {
  13598. return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
  13599. }
  13600. #endif
  13601. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  13602. static __inline__ vector signed __int128 __ATTRS_o_ai
  13603. vec_xl_be(signed long long __offset, signed __int128 *__ptr) {
  13604. return vec_xl(__offset, __ptr);
  13605. }
  13606. static __inline__ vector unsigned __int128 __ATTRS_o_ai
  13607. vec_xl_be(signed long long __offset, unsigned __int128 *__ptr) {
  13608. return vec_xl(__offset, __ptr);
  13609. }
  13610. #endif
  13611. #else
  13612. #define vec_xl_be vec_xl
  13613. #endif
  13614. /* vec_xst */
  13615. static inline __ATTRS_o_ai void vec_xst(vector signed char __vec,
  13616. signed long long __offset,
  13617. signed char *__ptr) {
  13618. *(vector signed char *)(__ptr + __offset) = __vec;
  13619. }
  13620. static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec,
  13621. signed long long __offset,
  13622. unsigned char *__ptr) {
  13623. *(vector unsigned char *)(__ptr + __offset) = __vec;
  13624. }
  13625. static inline __ATTRS_o_ai void vec_xst(vector signed short __vec,
  13626. signed long long __offset,
  13627. signed short *__ptr) {
  13628. *(vector signed short *)(__ptr + __offset) = __vec;
  13629. }
  13630. static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
  13631. signed long long __offset,
  13632. unsigned short *__ptr) {
  13633. *(vector unsigned short *)(__ptr + __offset) = __vec;
  13634. }
  13635. static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
  13636. signed long long __offset,
  13637. signed int *__ptr) {
  13638. *(vector signed int *)(__ptr + __offset) = __vec;
  13639. }
  13640. static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec,
  13641. signed long long __offset,
  13642. unsigned int *__ptr) {
  13643. *(vector unsigned int *)(__ptr + __offset) = __vec;
  13644. }
  13645. static inline __ATTRS_o_ai void vec_xst(vector float __vec,
  13646. signed long long __offset,
  13647. float *__ptr) {
  13648. *(vector float *)(__ptr + __offset) = __vec;
  13649. }
  13650. #ifdef __VSX__
  13651. static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
  13652. signed long long __offset,
  13653. signed long long *__ptr) {
  13654. *(vector signed long long *)(__ptr + __offset) = __vec;
  13655. }
  13656. static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
  13657. signed long long __offset,
  13658. unsigned long long *__ptr) {
  13659. *(vector unsigned long long *)(__ptr + __offset) = __vec;
  13660. }
  13661. static inline __ATTRS_o_ai void vec_xst(vector double __vec,
  13662. signed long long __offset,
  13663. double *__ptr) {
  13664. *(vector double *)(__ptr + __offset) = __vec;
  13665. }
  13666. #endif
  13667. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  13668. static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
  13669. signed long long __offset,
  13670. signed __int128 *__ptr) {
  13671. *(vector signed __int128 *)(__ptr + __offset) = __vec;
  13672. }
  13673. static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
  13674. signed long long __offset,
  13675. unsigned __int128 *__ptr) {
  13676. *(vector unsigned __int128 *)(__ptr + __offset) = __vec;
  13677. }
  13678. #endif
  13679. /* vec_xst_be */
  13680. #ifdef __LITTLE_ENDIAN__
  13681. static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
  13682. signed long long __offset,
  13683. signed char *__ptr) {
  13684. vector signed char __tmp =
  13685. __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
  13686. 13, 12, 11, 10, 9, 8);
  13687. __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
  13688. }
  13689. static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
  13690. signed long long __offset,
  13691. unsigned char *__ptr) {
  13692. vector unsigned char __tmp =
  13693. __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
  13694. 13, 12, 11, 10, 9, 8);
  13695. __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
  13696. }
  13697. static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
  13698. signed long long __offset,
  13699. signed short *__ptr) {
  13700. vector signed short __tmp =
  13701. __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
  13702. __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
  13703. }
  13704. static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
  13705. signed long long __offset,
  13706. unsigned short *__ptr) {
  13707. vector unsigned short __tmp =
  13708. __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
  13709. __builtin_vsx_stxvd2x_be(__tmp, __offset, __ptr);
  13710. }
  13711. static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
  13712. signed long long __offset,
  13713. signed int *__ptr) {
  13714. __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
  13715. }
  13716. static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
  13717. signed long long __offset,
  13718. unsigned int *__ptr) {
  13719. __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
  13720. }
  13721. static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
  13722. signed long long __offset,
  13723. float *__ptr) {
  13724. __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
  13725. }
  13726. #ifdef __VSX__
  13727. static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
  13728. signed long long __offset,
  13729. signed long long *__ptr) {
  13730. __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
  13731. }
  13732. static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
  13733. signed long long __offset,
  13734. unsigned long long *__ptr) {
  13735. __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
  13736. }
  13737. static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
  13738. signed long long __offset,
  13739. double *__ptr) {
  13740. __builtin_vsx_stxvd2x_be(__vec, __offset, __ptr);
  13741. }
  13742. #endif
  13743. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  13744. static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
  13745. signed long long __offset,
  13746. signed __int128 *__ptr) {
  13747. vec_xst(__vec, __offset, __ptr);
  13748. }
  13749. static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
  13750. signed long long __offset,
  13751. unsigned __int128 *__ptr) {
  13752. vec_xst(__vec, __offset, __ptr);
  13753. }
  13754. #endif
  13755. #else
  13756. #define vec_xst_be vec_xst
  13757. #endif
  13758. #ifdef __POWER9_VECTOR__
  13759. #define vec_test_data_class(__a, __b) \
  13760. _Generic((__a), \
  13761. vector float: \
  13762. (vector bool int)__builtin_vsx_xvtstdcsp((__a), (__b)), \
  13763. vector double: \
  13764. (vector bool long long)__builtin_vsx_xvtstdcdp((__a), (__b)) \
  13765. )
  13766. #endif /* #ifdef __POWER9_VECTOR__ */
  13767. static vector float __ATTRS_o_ai vec_neg(vector float __a) {
  13768. return -__a;
  13769. }
  13770. #ifdef __VSX__
  13771. static vector double __ATTRS_o_ai vec_neg(vector double __a) {
  13772. return -__a;
  13773. }
  13774. #endif
  13775. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  13776. static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
  13777. return -__a;
  13778. }
  13779. #endif
  13780. static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
  13781. return -__a;
  13782. }
  13783. static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
  13784. return -__a;
  13785. }
  13786. static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
  13787. return -__a;
  13788. }
  13789. static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
  13790. return - vec_abs(__a);
  13791. }
  13792. #ifdef __VSX__
  13793. static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
  13794. return - vec_abs(__a);
  13795. }
  13796. #endif
  13797. #if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
  13798. static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
  13799. return __builtin_altivec_vminsd(__a, -__a);
  13800. }
  13801. #endif
  13802. static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
  13803. return __builtin_altivec_vminsw(__a, -__a);
  13804. }
  13805. static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
  13806. return __builtin_altivec_vminsh(__a, -__a);
  13807. }
  13808. static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
  13809. return __builtin_altivec_vminsb(__a, -__a);
  13810. }
  13811. #undef __ATTRS_o_ai
  13812. #endif /* __ALTIVEC_H */