Source/Packages

Accelerator.SM86.InstructionEncoding

packages/hardware/architectures/nvidia-sm86/src/Accelerator/SM86/InstructionEncoding.alpha

2,937 lines191 declarations105.3 KiBSHA-256 0462dcc8328a

def · lines 1861–2198

sm86EncodeSystem

Full file
Opcodes (base | form << 9): ATOMG 0x9a8, ATOMG.CAS 0x3a9, RED 0x98e, MEMBAR 0x992, ERRBAR 0x9ab, CCTL 0x98f, NANOSLEEP 0x95d, ISETP 0x20c, SEL 0x207, IMNMX 0x217, IMAD 0x224, BRX 0x949, CALL.REL 0x344, RET.REL 0x950, POPC 0x309, VOTE 0x806, BAR 0xb1d.
1861def sm86EncodeSystem =
1862  (lambda unrestricted guard : SM86InstructionGuard .
1863    unrestricted operation : SM86SystemOperation .
1864    unrestricted control : SM86Control .
1865    eliminate
1866      SM86SystemOperation
1867      (lambda unrestricted current : SM86SystemOperation . SM86InstructionEncodingResult)
1868      operation
1869      (branch
1870        SM86AtomicGlobal
1871        atomic
1872        scope
1873        destination
1874        address
1875        value
1876        offset
1877        .
1878        then (sm86EncodeInstructionFields 2472 guard control)
1879          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
1880          (sm86InstructionPrependField 24 8 (sm86RegisterNatural address))
1881          (sm86InstructionPrependField 32 8 (sm86RegisterNatural value))
1882          (sm86InstructionPrependField 40 sm86GlobalOffsetFieldBits (sm86Unsigned32Natural offset))
1883          (sm86InstructionOneWord32Field 64)
1884          sm86Unsigned32FromNaturalTruncated
1885          (nest nat-add
1886            136184260
1887            (nat-multiply 8388608 (sm86AtomicOperationNatural atomic)))
1888            (nat-multiply 8192) (sm86MemoryScopeOrderNatural scope))
1889      (branch
1890        SM86AtomicCompareSwapGlobal
1891        scope
1892        destination
1893        address
1894        compare
1895        value
1896        offset
1897        .
1898        then (sm86EncodeInstructionFields 937 guard control)
1899          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
1900          (sm86InstructionPrependField 24 8 (sm86RegisterNatural address))
1901          (sm86InstructionPrependField 32 8 (sm86RegisterNatural compare))
1902          (sm86InstructionPrependField 40 sm86GlobalOffsetFieldBits (sm86Unsigned32Natural offset))
1903          (sm86InstructionOneWord32Field 64)
1904          sm86Unsigned32FromNaturalTruncated
1905          (nest nat-add
1906            1966336
1907            (sm86RegisterNatural value))
1908            (nat-multiply 8192) (sm86MemoryScopeOrderNatural scope))
1909      (branch
1910        SM86ReduceGlobal
1911        reduction
1912        scope
1913        address
1914        value
1915        offset
1916        .
1917        nat-eliminate
1918          (lambda unrestricted current : Nat . SM86InstructionEncodingResult)
1919          (then (sm86EncodeInstructionFields 2446 guard control)
1920            (sm86InstructionPrependField 24 8 (sm86RegisterNatural address))
1921            (sm86InstructionPrependField 32 8 (sm86RegisterNatural value))
1922            (sm86InstructionPrependField
1923              40
1924              sm86GlobalOffsetFieldBits
1925              (sm86Unsigned32Natural offset))
1926            (sm86InstructionOneWord32Field 64)
1927            sm86Unsigned32FromNaturalTruncated
1928            (nest nat-add
1929              202375556
1930              (nat-multiply 8388608 (sm86AtomicOperationNatural reduction)))
1931              (nat-multiply 8192) (sm86MemoryScopeOrderNatural scope))
1932          (lambda unrestricted predecessor : Nat .
1933            unrestricted induction : SM86InstructionEncodingResult .
1934            sm86InstructionUnsupported 2446)
1935          (sm86AtomicOperationIsExchange reduction))
1936      (branch
1937        SM86MemoryBarrier
1938        scope
1939        mode
1940        .
1941        then (sm86EncodeInstructionFields 2450 guard control)
1942          (sm86InstructionOneWord32Field 64)
1943          sm86Unsigned32FromNaturalTruncated
1944          (nat-add (nat-multiply 4096 (sm86MemoryScopeBarrierNatural scope)))
1945          (nat-multiply 32768)
1946          sm86FenceModeNatural
1947          mode)
1948      (branch
1949        SM86ErrorBarrier
1950        .
1951        sm86EncodeInstructionFields 2475 guard control sm86InstructionFieldsEmpty)
1952      (branch
1953        SM86InvalidateDataCache
1954        .
1955        then (sm86EncodeInstructionFields 2447 guard control)
1956          (sm86InstructionPrependField 24 8 255)
1957          (sm86InstructionOneWord32Field 64)
1958          sm86Unsigned32FromNaturalTruncated
1959          33554432)
1960      (branch
1961        SM86LoadGlobalStrong
1962        scope
1963        destination
1964        address
1965        offset
1966        .
1967        then (sm86EncodeInstructionFields sm86OpcodeLoadGlobal guard control)
1968          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
1969          (sm86InstructionPrependField 24 8 (sm86RegisterNatural address))
1970          (sm86InstructionPrependField 32 8 4)
1971          (sm86InstructionPrependField 40 sm86GlobalOffsetFieldBits (sm86Unsigned32Natural offset))
1972          (sm86InstructionOneWord32Field 64)
1973          sm86Unsigned32FromNaturalTruncated
1974          (nat-add 203299072)
1975          (nat-multiply 8192)
1976          sm86MemoryScopeOrderNatural
1977          scope)
1978      (branch
1979        SM86StoreGlobalStrong
1980        scope
1981        address
1982        value
1983        offset
1984        .
1985        then (sm86EncodeInstructionFields sm86OpcodeStoreGlobal guard control)
1986          (sm86InstructionPrependField 24 8 (sm86RegisterNatural address))
1987          (sm86InstructionPrependField 32 8 (sm86RegisterNatural value))
1988          (sm86InstructionPrependField 40 sm86GlobalOffsetFieldBits (sm86Unsigned32Natural offset))
1989          (sm86InstructionOneWord32Field 64)
1990          sm86Unsigned32FromNaturalTruncated
1991          (nat-add 202381572)
1992          (nat-multiply 8192)
1993          sm86MemoryScopeOrderNatural
1994          scope)
1995      (branch
1996        SM86Sleep
1997        nanoseconds
1998        .
1999        then (sm86EncodeInstructionFields 2397 guard control)
2000          (sm86InstructionPrependWord32Field 32 nanoseconds)
2001          (sm86InstructionOneWord32Field 64)
2002          sm86Unsigned32FromNaturalTruncated
2003          58720256)
2004      (branch
2005        SM86CompareRegisters
2006        comparison
2007        signedness
2008        destination
2009        left
2010        right
2011        .
2012        then (sm86EncodeInstructionFields 524 guard control)
2013          (sm86InstructionPrependField 24 8 (sm86RegisterNatural left))
2014          (sm86InstructionPrependField 32 8 (sm86RegisterNatural right))
2015          (sm86InstructionOneWord32Field 64)
2016          sm86Unsigned32FromNaturalTruncated
2017          (nest nat-add
2018            66060400
2019            (nat-multiply 4096 (sm86IntegerComparisonNatural comparison))
2020            (nat-multiply 512 (sm86IntegerSignednessNatural signedness)))
2021            (nat-multiply 131072) (sm86PredicateNatural destination))
2022      (branch
2023        SM86SelectRegisters
2024        destination
2025        whenTrue
2026        whenFalse
2027        predicate
2028        sense
2029        .
2030        then (sm86EncodeInstructionFields 519 guard control)
2031          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
2032          (sm86InstructionPrependField 24 8 (sm86RegisterNatural whenTrue))
2033          (sm86InstructionPrependField 32 8 (sm86RegisterNatural whenFalse))
2034          (sm86InstructionOneWord32Field 64)
2035          sm86Unsigned32FromNaturalTruncated
2036          (nat-add (nat-multiply 8388608 (sm86PredicateNatural predicate)))
2037          (nat-multiply 67108864)
2038          sm86PredicateSenseNatural
2039          sense)
2040      (branch
2041        SM86IntegerMinimumOrMaximum
2042        mode
2043        signedness
2044        destination
2045        left
2046        right
2047        .
2048        then (sm86EncodeInstructionFields 535 guard control)
2049          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
2050          (sm86InstructionPrependField 24 8 (sm86RegisterNatural left))
2051          (sm86InstructionPrependField 32 8 (sm86RegisterNatural right))
2052          (sm86InstructionOneWord32Field 64)
2053          sm86Unsigned32FromNaturalTruncated
2054          (nest nat-add
2055            58720256
2056            (nat-multiply 67108864 (sm86IntegerExtremumNatural mode)))
2057            (nat-multiply 512) (sm86IntegerSignednessNatural signedness))
2058      (branch
2059        SM86MoveRegister
2060        destination
2061        source
2062        .
2063        then (sm86EncodeInstructionFields 548 guard control)
2064          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
2065          (sm86InstructionPrependField 24 8 255)
2066          (sm86InstructionPrependField 32 8 255)
2067          (sm86InstructionOneWord32Field 64)
2068          sm86Unsigned32FromNaturalTruncated
2069          (nat-add 126746624)
2070          sm86RegisterNatural
2071          source)
2072      (branch
2073        SM86IntegerMultiplyAddRegister
2074        destination
2075        left
2076        right
2077        addend
2078        .
2079        then (sm86EncodeInstructionFields 548 guard control)
2080          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
2081          (sm86InstructionPrependField 24 8 (sm86RegisterNatural left))
2082          (sm86InstructionPrependField 32 8 (sm86RegisterNatural right))
2083          (sm86InstructionOneWord32Field 64)
2084          sm86Unsigned32FromNaturalTruncated
2085          (nat-add 126746624)
2086          sm86RegisterNatural
2087          addend)
2088      -- SR_TID.* and SR_CTAID.* (0x20 .. 0x27) are refused: the grid
2089      -- rewrites (GroupedLaunch, GridBand) find grid coordinates only in
2090      -- SM86SpecialToRegister, so they must not arrive another way.
2091      (branch
2092        SM86ReadSystemRegister
2093        destination
2094        code
2095        .
2096        nat-eliminate
2097          (lambda unrestricted current : Nat . SM86InstructionEncodingResult)
2098          (then (sm86EncodeInstructionFields sm86OpcodeSpecialToRegister guard control)
2099            (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
2100            (sm86InstructionOneField 72 8)
2101            byte-to-nat
2102            code)
2103          (lambda unrestricted predecessor : Nat .
2104            unrestricted induction : SM86InstructionEncodingResult .
2105            sm86InstructionUnsupported 2329)
2106          (naturalAnd (nat-less-than 31 (byte-to-nat code)) (nat-less-than (byte-to-nat code) 40)))
2107      (branch
2108        SM86BranchIndirect
2109        register
2110        offset
2111        .
2112        sm86EncodeRelativeTransfer 2377 58720256 guard register offset control)
2113      (branch
2114        SM86CallIndirect
2115        register
2116        offset
2117        .
2118        sm86EncodeRelativeTransfer 836 62914560 guard register offset control)
2119      (branch
2120        SM86ReturnIndirect
2121        register
2122        offset
2123        .
2124        sm86EncodeRelativeTransfer 2384 62914560 guard register offset control)
2125      (branch
2126        SM86PopulationCount
2127        destination
2128        source
2129        .
2130        then (sm86EncodeInstructionFields 777 guard control)
2131          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
2132          (sm86InstructionOneField 32 8)
2133          sm86RegisterNatural
2134          source)
2135      (branch
2136        SM86VoteBallot
2137        destination
2138        predicate
2139        sense
2140        .
2141        then (sm86EncodeInstructionFields 2054 guard control)
2142          (sm86InstructionPrependField 16 8 (sm86RegisterNatural destination))
2143          (sm86InstructionOneWord32Field 64)
2144          sm86Unsigned32FromNaturalTruncated
2145          (nest nat-add
2146            917760
2147            (nat-multiply 8388608 (sm86PredicateNatural predicate)))
2148            (nat-multiply 67108864) (sm86PredicateSenseNatural sense))
2149      (branch
2150        SM86BarrierArrive
2151        barrier
2152        threads
2153        .
2154        then (sm86EncodeInstructionFields 2845 guard control)
2155          (sm86InstructionPrependField 42 12 threads)
2156          (sm86InstructionPrependField 54 4 (byte-to-nat barrier))
2157          (sm86InstructionOneWord32Field 64)
2158          sm86Unsigned32FromNaturalTruncated
2159          8192)
2160      -- BSSY 0x945 / BSYNC 0x941: the barrier at bit 16, BSSY's
2161      -- displacement at 32, 0x03800000 above (ptxas's words; sm_121's add
2162      -- .RECONVERGENT at bit 73)
2163      (branch
2164        SM86ConvergenceStart
2165        barrier
2166        displacement
2167        .
2168        then (sm86EncodeInstructionFields 2373 guard control)
2169          (sm86InstructionPrependField 16 4 (byte-to-nat barrier))
2170          (sm86InstructionPrependField 32 32 (sm86Unsigned32Natural displacement))
2171          (sm86InstructionOneWord32Field 64)
2172          sm86Unsigned32FromNaturalTruncated
2173          58720256)
2174      (branch
2175        SM86ConvergenceWait
2176        barrier
2177        .
2178        then (sm86EncodeInstructionFields 2369 guard control)
2179          (sm86InstructionPrependField 16 4 (byte-to-nat barrier))
2180          (sm86InstructionOneWord32Field 64)
2181          sm86Unsigned32FromNaturalTruncated
2182          58720256)
2183      (branch
2184        SM86LabelDistance
2185        destination
2186        from
2187        to
2188        .
2189        sm86EncodeMoveImmediate
2190          guard
2191          destination
2192          (pipe to
2193            sm86Unsigned32Natural
2194            (nat-add 4294967296)
2195            (nat-subtract (sm86Unsigned32Natural from))
2196            (nat-modulo 4294967296)
2197            sm86Unsigned32FromNaturalTruncated)
2198          control))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.